Enemy Physics

I have an enemy mobile and want to be able for it to react to physics the same way as my player does (bump into walls, stay on the ground, run up small ledges).

Should I have each enemy be a PhysicsCharacterNode, or is this class only reserved for players? I tried to get this working, but the PhysicsCharacterNode would not allow me to use a mesh shape.

If I use a normal PhysicsNode and use the “move” method to move my object, it will walk straight through walls, etc.

What am I missing?


You can do that to your liking but as the tutorial says, you should not move around physics objects like that but by using forces. The way you move it its being beamed from point to point so it gets stuck in the wall.

As far as I know the physchar only supports sphere and capsule shapes, but that would by my approach, in fact I would create a Npc class that handles the physcontroll stuff and give it a interface for commands. Then on the interface I either set a playercontroller or a AIcontroller that gives input to the underlieing Npc class.

The Physics Character supports the base shapes and now also HullCollisionShapes, but no compound shapes.