Weird CollisionHandlerPusher behaviour

Hey panda’s,

Im trying to use the CollisionHandlerPusher but it behaves very weird.
Watch this video, then you’ll know what I mean.
The terrain consists of just 1 egg file.
This is my code:

    base.cTrav = CollisionTraverser()
    self.terrain.setCollideMask(BitMask32.bit(1))
    self.camsphere = CollisionNode('camsphere')
    self.camsphere.addSolid(CollisionSphere(0,0,0.1,0.75))
    self.camsphere.setFromCollideMask(BitMask32.bit(1))
    self.camsphere.setIntoCollideMask(BitMask32.allOff())
    self.camsphereNP=render.attachNewNode(self.camsphere)
    self.camsphereNP.setZ(1.0)
    self.playerdummy=self.camsphereNP
    self.camCollHandler = CollisionHandlerPusher()
    base.cTrav.addCollider(self.camsphereNP,self.camCollHandler)
    self.camCollHandler.addCollider(self.camsphereNP,self.playerdummy) 

(and some more movement code to move self.playerdummy)

Can anybody help me?

I think this is the same problem I have encountered some time ago:

https://discourse.panda3d.org/viewtopic.php?t=2419

“Sharp” (90 degree or more) edges seem to be the problem. I have tried to compile Panda3D myself and play around with the collision code. But I didn’t spend much time on understanding how it works, and so I wasn’t surprised that I failed here.

My solution so far: using a physics engine (ODE, Newton, Tokama, …)

enn0x

isn’t there a way to achieve the same result using a queue or something else?

I think the problem is the way the pusher handles the collisions. The collision systems find two or more normals in contact with the sphere, and the pusher selects one of them, and then applies a correction according to the one collision normal it has selected.

But I don’t know enough about Panda3D internals to give a solid answer here. drwr might be able to.

Using a queue could work, but then you have to implement collision response yourself, since queue is (AFAIK) only a list of collision entries, and nothing happens if you don’t code a response yourself.

enn0x

Did you try to turn on debug messages for the collision system? I think this is how I did back then:

loadPrcFileData( '', 'notify-level-collide debug' )

It will be very spammy, so a re-direct to a file might be usefull. Perhaps this way (by comparing the messages with the Panda3D source code) you might be able to narrow the problem down to a particular part of the code.

Thanks enn0x.

I wasn’t able to fix it- so I now use a CollisionHandlerQueue, and each frame it checks whether there was a collision or not, it there was, it sets the position to the previous one. It doesn’t slide along the wall anymore, but it doesn’t penetrate the wall either.