Using the built-in collision system, is there a way (short of writing my own collision class or classes, or implementing CollisionHandlerPusher’s functionality in Python event callbacks, I suppose) of constraining the collision system to acting only in a given plane (the XZ plane, in my case)? My current game is 2D in nature, but I’m using the collision system for wall collisions. Since tubes and spheres are, I believe, an efficient combination (and tubes make for good joints between stretches of wall) I’m using the former for my walls and the latter for my objects. However, I suspect that I may be getting objects pushed along the y-axis, which is a bit of a problem (for one thing I’m concerned about it causing objects to “miss” walls every so often).
If this isn’t reasonably feasible in the built-in collision system, is it feasible using Bullet?
This is a really specific behaviour, and you probably shouldn’t expect a collision system to be able to do it off the bat. The easiest way is to change to an event collision handler and then sensibly interpreting the collision events by yourself every frame.
You can get the normal of the collision, and you can get how far in the object has collided, so you can work out how far backwards to move along the normal to get the objects to just be touching.
Edit: Or if your only problem is the handler sometimes pushes the characters in the axis you’re not using, you could just reset this to 0 every frame.
Fair enough – it was worth asking, I think.
As to resetting the y-coordinate to 0, I am doing that at the moment, I believe, but it may leave me with situations in which doing so results in the object intersecting the wall as a result of having been pushed less than the wall’s width in the xz-plane and a small distance along the y-axis.