Animating collision box weird problems
by Thomas \"Man of Ice\" Lund · in Torque Game Engine · 03/25/2004 (7:12 am) · 5 replies
I have a very strange problem with an animation when it gets ingame (head from end of February)
Inside max I create a piston like animation. It goes back and forth, and I want to use it to push a player down from a bridge (if he doesnt evade the piston).
In max I got the animation fine. Collision box is wired to the animation in the correct axis, and there are no errors in the dump file.
When I get ingame though, the collision box is only animated on the one side. Let me try to draw
This is what should happen (and it happens in MAX)
* = collision box
- = piston
This is what happens ingame
The bounds box is long enough to have the complete animation + collision box inside it.
But it seems as if the collision box is retracted correctly, but never moved beyong the initial point. Unsure how to explain. It never hits anything on the right side, but I can stand on top of it in rest position, and when the piston moves, the collision box is moved too on the left side, as I fall down.
Does anyone have any clue what happens?
Inside max I create a piston like animation. It goes back and forth, and I want to use it to push a player down from a bridge (if he doesnt evade the piston).
In max I got the animation fine. Collision box is wired to the animation in the correct axis, and there are no errors in the dump file.
When I get ingame though, the collision box is only animated on the one side. Let me try to draw
This is what should happen (and it happens in MAX)
* = collision box
- = piston
In rest position:
****************
*--------------*
****************
In fully extended position:
****************
*--------------*
****************This is what happens ingame
In rest position:
****************
*--------------*
****************
In fully extended position:
**
*--------------
**The bounds box is long enough to have the complete animation + collision box inside it.
But it seems as if the collision box is retracted correctly, but never moved beyong the initial point. Unsure how to explain. It never hits anything on the right side, but I can stand on top of it in rest position, and when the piston moves, the collision box is moved too on the left side, as I fall down.
Does anyone have any clue what happens?
#2
I dont realy know how to do that but maby you can figure it out.
03/25/2004 (3:04 pm)
Try to move the piston back and forth with script instead of having it animated, might solve it. I dont realy know how to do that but maby you can figure it out.
#3
@David - it seems that its the only way to do this unfortunally. As Martin says the collision is not registered (why?) in either the piston or player until the player moves. By using script to move it I hope that the collision will register with a resting player too
But the missing collision box on the right side must be some kind of bug - I've looked at the model for hours and tried various solutions. But none work on the right side.
I can post the model and dts if anyone cares to take a look
03/25/2004 (11:34 pm)
@Martin - I tested that too. It works like that on the left side. Piston goes through my player, and when I move the collision is detected and I'm "stuck". But on the right side I can move through the extended piston with no collision.@David - it seems that its the only way to do this unfortunally. As Martin says the collision is not registered (why?) in either the piston or player until the player moves. By using script to move it I hope that the collision will register with a resting player too
But the missing collision box on the right side must be some kind of bug - I've looked at the model for hours and tried various solutions. But none work on the right side.
I can post the model and dts if anyone cares to take a look
#4
BTW, your problem can be solved very easy in scripting, in Weapon::onFire() do a castRay() forward (using muzzlePoint and muzzleVector) to pick the hit entity and do an applyImpulse() on it.
03/26/2004 (5:40 am)
I believe that the collision isn't animatable at all (at least it didn't worked in my tests). The only way to one object to collide with other is to manually move it.BTW, your problem can be solved very easy in scripting, in Weapon::onFire() do a castRay() forward (using muzzlePoint and muzzleVector) to pick the hit entity and do an applyImpulse() on it.
#5
The collision mesh IS animatable. I've read about someone making a door (somewhere on the forums), and my collision mesh is animated on the left side (see drawing).
But I understand the problem with an animation. Once collision occurs you cannot stop the animation etc.etc.
So all in all a scriptable solution is the right thing.
03/26/2004 (6:01 am)
Good idea with the castRay() thing...... might be usable if the animation of the piston is fast so you wont notice any delay from animation hits you to the impulsa kicks in.The collision mesh IS animatable. I've read about someone making a door (somewhere on the forums), and my collision mesh is animated on the left side (see drawing).
But I understand the problem with an animation. Once collision occurs you cannot stop the animation etc.etc.
So all in all a scriptable solution is the right thing.
Torque 3D Owner Martin "Founder" Hoover