So right before our presentation on our game, we found out that some of the enemies were falling through the ground. I was certain we had set “respect previous transform”, but it didn’t seem to be helping.

I then discovered that had this been working, I would see the previous transform when I showed our collision sphere. Since I couldn’t I figured something was wrong.

Then pro-rsoft told me about CollisionHandlerFluidPusher (on irc). After looking at the source code for Panda3d I could see why our previous transforms weren’t doing well. We were using PhysicsCollisionHandler, which inherits from CollisionHandlerPusher, which wipes out the previous transform (calls setPos instead of setFluidPos).

Can I add a PhysicsCollisionFluidHandler to Panda3D? Where would I submit the patch? I’m planning to start on this after exams, probably in a few days.

Hmm, I’m not entirely sure that’s the root of the problem. It’s true that CollisionHandlerPusher just uses setPos(), but it uses this to push the objects out of the walls, which is the correct thing to do. You wouldn’t want a setFluidPos() operation when you’re being pushed out of the walls, because that would risk the push operation getting stopped by another collision pass–resulting in your object falling through the wall it was supposed to be pushed out of!

CollisionHandlerFluidPusher is a relatively experimental pusher that one of our engineers has been working on. It is intended to better solve the problems associated with walls at acute angles and such. It probably won’t have any effect on objects simply falling through a floor.

If your ground is perfectly flat, one very easy solution is to replace the ground polygon with a plane, since polygons are infinitely thin, but planes are infinitely thick–it’s impossible to fall through a plane.