Altering Bullet's changes from a collision

WittyUserName
Posts: 4
Joined: Sun Feb 07, 2010 3:24 pm

Altering Bullet's changes from a collision

Post by WittyUserName »

Hi all,

I was wondering if anyone could tell me if there's a best/recommended way to alter the results of a collision. I have a simulation in which I'd like to enforce energy conservation in collisions involving some of the moving objects, but still let Bullet handle all the other aspects of the simulation (collision with static objects, motion damping, gravity, etc.).

At the moment the most obvious way seems to be in a post-tick callback: I just check for pairs of elastic objects in contact, and doctor up their velocities. This seems to work for collisions involving only two objects, although I think I may also need to adjust their positions (because they have traveled between the collision time and the end of the tick at the wrong velocities). It fails pretty badly for more objects, though.

Anyway, I just wanted to see if there is a better and/or smarter way to go about this. If I've missed something obvious in the docs (or if you can point me to some other source that has better ideas), I'm glad to go read up on it if somebody can point the way.

Thanks!