Object moving but visible component remaining in original loc.
by Rob Green · in Technical Issues · 05/23/2005 (6:58 pm) · 3 replies
So I wrote/ripped some code very similar to Tribes 2's flag code and I'm having a problem...
Here's how it's supposed to work:
After the player touches the enemy flag, a flag image is mounted on the player, a bunch of variables about states of things are set, and the flag (let's call it Flag2) is hidden, via a call to Flag2.setHidden(true).
If the player throws the flag or dies, the flag image is unmounted from the player, and the real flag gets transformed to the player's position with a little impulse for a 'toss' like feel (see demo throwObject()) and Flag2.setHidden(false).
You would think this would work correctly, providing the illusion that the player really picked up the flag and threw it.
What's weird is that it totally almost works, as in I can pick up the flag and then throw it, but the problem is that it never becomes visible again after I throw it. If I look in the mission editor, it's right there where I threw it, but invisible, but when I click on it, the flag reappears. The object definitely moved because I can re-pick it up again and re-throw it again over and over, but the visible part of the object stays where it started.
I turned off my hiding of the flag to test, and wouldn't you know, after I pick up and throw the flag, the mission editor sees the flag has moved correctly, but there is still an old image of where the flag originally was sitting on the ground animating like there's still an object there, and the new flag position has no visible flag on it (unless I recall Flag2.setHidden(false) a few seconds later, or click on the box where the flag should be visible in the mission editor).
Anyone have any ideas on this? I looked through the Tribes2 script code and found that they call some sort of ShapeBase::hide method, which isn't scripted so it must be in C++. That's probably irrelevant, since when I didn't hide the thing, the object moved like it was supposed to but the image never moved in the scene. It's like there's some sort of disconnect there.
Again, Anyone know anything about this sort of thing? Any help is appreciated...
Here's how it's supposed to work:
After the player touches the enemy flag, a flag image is mounted on the player, a bunch of variables about states of things are set, and the flag (let's call it Flag2) is hidden, via a call to Flag2.setHidden(true).
If the player throws the flag or dies, the flag image is unmounted from the player, and the real flag gets transformed to the player's position with a little impulse for a 'toss' like feel (see demo throwObject()) and Flag2.setHidden(false).
You would think this would work correctly, providing the illusion that the player really picked up the flag and threw it.
What's weird is that it totally almost works, as in I can pick up the flag and then throw it, but the problem is that it never becomes visible again after I throw it. If I look in the mission editor, it's right there where I threw it, but invisible, but when I click on it, the flag reappears. The object definitely moved because I can re-pick it up again and re-throw it again over and over, but the visible part of the object stays where it started.
I turned off my hiding of the flag to test, and wouldn't you know, after I pick up and throw the flag, the mission editor sees the flag has moved correctly, but there is still an old image of where the flag originally was sitting on the ground animating like there's still an object there, and the new flag position has no visible flag on it (unless I recall Flag2.setHidden(false) a few seconds later, or click on the box where the flag should be visible in the mission editor).
Anyone have any ideas on this? I looked through the Tribes2 script code and found that they call some sort of ShapeBase::hide method, which isn't scripted so it must be in C++. That's probably irrelevant, since when I didn't hide the thing, the object moved like it was supposed to but the image never moved in the scene. It's like there's some sort of disconnect there.
Again, Anyone know anything about this sort of thing? Any help is appreciated...
#2
Basically, it simply won't visibly show itself in the air at all, only on the ground.
WTF
05/24/2005 (8:59 am)
Ok just to debug I did %flag.setScopeAlways() and it showed some strange behavior. After the player threw the flag, the flag would hit the ground (invisibly, as the real flag would stay in one spot as this happened), and then after some seemingly arbitrary short period of time, the real flag would quickly slide over from it's current spot to where the flag is supposed to be.Basically, it simply won't visibly show itself in the air at all, only on the ground.
WTF
#3
05/26/2005 (11:30 pm)
Just FYI, I found the solution to this. TGE 1.3 has a bug in it's item netcode that causes problems like this when using collision timeouts. I was able to fix my bug in my engine, but for you non-engine owners, I suggest changing your throw object script to set the transform x +4 and comment out the collision timeout, as that is a hack but should make it work for you.
Torque Owner Rob Green
Now when the player dies/throws the flag, the real flag object does move to the correct location, but only after some delay. It's strange, because in the code, I unmount the flag image from the player, then on the very next line set the flag object to visible again, but in the game it's as if the flag needs to touch the ground and sit there for a second or so before actually becoming visible.
Now I'm really not sure what I should be looking for. Should I be messing with some scope stuff?