Game Development Community

Tweaking Vehicle Collision Response

by Mark Dynna · in Torque Game Engine Advanced · 06/25/2009 (8:28 am) · 3 replies

Hey, I'm hoping someone can point me in the right direction as far as the code. If I wanted to change how a vehicle responds (physics-wise) to collisions with certain types of objects, where would I make that change?

Right now I have a vehicle colliding with a ShapeBase-based object, and the vehicle stops as if hitting a wall. I'd like the object that is hit to be thrown out of the way (which I've got working) and the vehicle to continue moving while only losing a bit of its speed/momentum.

I was playing with the Rigid::ResolveCollision function and trying to modify some of the forces in there based on what kind of object was hit. Am I looking in the right place? Thanks.

#1
07/01/2009 (10:49 am)
Thats because you need to apply an impulses to the objects during the collision. There are several examples around here on how to do that in script. Sure you could just write a coded method to do the same as well.

For script though look for applyImpulse.
#2
07/04/2009 (8:44 am)
I would have a look at Vehicle::resolveCollision before the same method in Rigid. Otherwise you'll be applying the same changes to all Rigid objects. I think at the moment the vehicle will apply a force to stop itself dead, and won't calculate any forces to push other objects. You'd want to reverse that - perform all the calculations on the colliding object and apply forces to it and just a little bit to the vehicle.
#3
07/09/2009 (6:02 am)
i would want to do something like how you said can u detail the description ? thanks in advance