collision pusher handler produce mixed results?

I’m working on a pseudo 2d maze construct mainly of cubes. And since it was just cubes I use the visible mesh to calculate collision as well:

self.mazeWall[i][j] = NodePath(self.loader.loadModel("greenCube.x"))
self.mazeWall[i][j].reparentTo(self.render)
self.mazeWall[i][j].setScale(4, 4, 4)
self.mazeWall[i][j].setPos(i*d, 0, -j*d)
self.mazeWall[i][j].setCollideMask(1)

As this is pseudo 2d, my avatar can only move in the X and Z axis. Thus I also constructed 2 collision planes to keep the avatar from moving in the Y axis.

The weird thing is the cubes can block movement on the X axis but it’s powerless on the Z axis. The avatar would come right through the walls if I move up/down, even popping a little bit into the collision planes.

I suspect the cubes could be the source of problem thus I posted that part of the code. Any suggestion? :unamused:

Pushers are restricted to the XY plane by default, for historical reasons. To restore full functionality, use:

pusher.setHorizontal(False)

David

thanks, it all work correctly now. Still something bother me: every time my avatar meet a protruding corner (where 2 collision polygons of different angles meet), it’s movement become a bit glitchy, not as smooth as I would like it to. Anyway I can fix this?

This is a fundamental problem with protruding corners. The most reliable way to fix this is to avoid these kinds of corners in your model.

But if that’s not possible, you could try using a CollisionHandlerFluidPusher instead of a CollisionHandlerPusher. This is a somewhat experimental class that is designed to reduce artifacts from corners like this.

David

Good job on the CollisionHandlerFluidPusher. Still I think it’s a bit of an overkill solution for now. I will try to add more collision polygons for rounder corners (as all of my collision polygons are procedural now), and hopefully that will lesser the problem?

Yes, that should help.

David