I did a search for this but couldn't find anything concrete.
Say I am using bullet dynamics to handle the behavior of my rigid bodies, then checking for collisions in the standard way by iterating over all the manifolds in an Internal Tick Callback. If I get the rigidbody from a manifold and call getLinearVelocity() will this be the pre-collision velocity, or will the velocity have already been changed during physics simulation? If it's not the pre-collision velocity, then is there an easy way to get it? It doesn't seem like it would be possible (or at least not simple) to reliably reverse engineer the pre-collision velocity using the impulse and mass if the object was in contact with multiple other bodies, but I might be missing something there.
If it comes down to it I guess I can always record the velocity from the last frame and use that, but is there a better way?
Getting pre-collision velocity of a rigid body.
-
- Posts: 4
- Joined: Fri Mar 08, 2013 6:11 pm
-
- Posts: 109
- Joined: Tue May 01, 2012 10:42 am
Re: Getting pre-collision velocity of a rigid body.
Maybe using the pre-tick callback?
http://bulletphysics.org/mediawiki-1.5. ... ck_example
http://bulletphysics.org/mediawiki-1.5. ... ck_example
-
- Posts: 4
- Joined: Fri Mar 08, 2013 6:11 pm
Re: Getting pre-collision velocity of a rigid body.
That looks like will it work nicely, thanks. So if I implemented that exact callback in the example would I get identical behaviour to regular Bullet? It seems that way but I just want to make sure.