Hey All,
I have one object in my physics simulation that moves very fast compared to it's size (it's a hockey puck), so I have issues with tunneling for that object. I believe from reading the forums that I need to use btCollisionWorld::convexSweepTest(...) on the puck so that it can find collisions even when the puck is going to tunnel though objects.
My question is, where am I supposed to put this function with respect to my simulation loop? The function requires a "from" and "to" transform, should I try to figure out the "to" by calculating the position after a timestep by hand, or do I run the test after the puck has already tunneled through another object? Also, how am I supposed to take any collisions generated by this test and feed them to bullet so that bullet can change the velocities of the bodies that collided?
Thanks for your help
How to use convexSweepTest
-
- Posts: 133
- Joined: Wed Jul 27, 2005 1:05 pm
- Location: Berkeley, CA
Re: How to use convexSweepTest
Not knowing what your main loop looks like, you (probably) should be performing this test around the same point that you are moving your player characters. Yes, the "to" should be the position of the puck at the end of the time step. Using the results of convexSweepTest() you can then manually determine the pucks final position (taking into account ricochet -- requiring multiple convexSweepTest calls after each from / to update.)
Hope that helps,
John
Hope that helps,
John
-
- Posts: 145
- Joined: Tue Oct 30, 2007 9:23 pm
Re: How to use convexSweepTest
You could also just lower the fixedTimeStep [third argument to stepSimulation].
It makes things a little more processor-expensive, but it also is easy and fast and requires no code modification beyond the addition of a simple btScalar to a function you're already using.
Gary (-;
It makes things a little more processor-expensive, but it also is easy and fast and requires no code modification beyond the addition of a simple btScalar to a function you're already using.
Gary (-;