away3d / awayphysics-core-fp11

Away Physics - 3D physics library for the Away3D Engine in Flash Player 11
http://www.awayphysics.com
112 stars 47 forks source link

collision callbacks don't work consistently #18

Open dtramer opened 11 years ago

dtramer commented 11 years ago

The problem happens much more if you use a higher step frequency (meaning the 3rd parameter to the away physics world step function is lower).

Some background:

The awayphysics collision callbacks are called from the awayphysics step function.

As suggested here: http://www.bulletphysics.org/mediawiki-1.5.8/index.php/Collision_Callbacks_and_Triggers the awayphysics step function iterates over all of the contact manifolds.

The problem is that awayphysics doesn’t follow this additional advice from that link:

“This should be done during a simulation tick (substep) callback, because contacts might be added and removed during several substeps of a single stepSimulation call.”

So, what is happening is that if the collision occurs during one of those in between sub-steps, the collision callback won’t be called.

I initially reported this here: http://away3d.com/forum/viewthread/2997/ and JohnBrookes posted there that he was able to reproduce the problem.

dtramer commented 11 years ago

muzerly - your change fixed this. Thanks.