I am currently testing simple collisions from my moving car (
CollisionBox) and walls/obstacles (
So far, I have got the collisions working in the sense that the walls do push back against the player, and (kind of) stop it from moving, and allow me to slide along the wall. However, if I keep attempting to move forward, the player tunnels straight through the wall.
I have tried using
pusher.setHorizontal(True) to prevent it from scaling the wall but this only prevented the object from moving over the wall, not straight through it.
How to I make sure the car does not magically end up on the other side of the wall? What am I doing wrong?
Key part of code:
# Model initialised and rendered to render as parent colNode = model.attachNewNode(CollisionNode(nodeName)) # Wall Handling # Initialise pusher collision handling pusher = CollisionHandlerPusher() pusher.addCollider(colNode, self.model, base.drive.node()) # pusher.addCollider(colNode, base.camera , base.drive.node()) pusher.addInPattern('%fn-in-%in') pusher.addOutPattern('%fn-out-%in') # Problem is the racecar will attempt to scale the wall # Unfortunately still does not fix it # TODO: Try http://www.panda3d.org/manual/?title=Rapidly-Moving_Objects pusher.setHorizontal(True) base.cTrav.addCollider(colNode, pusher)