I'm writing a Final Fantasy-like game engine, with 2D backgrounds and 3D models with Irrlicht. To calculate collisions with the objects in the background I use a invisible mesh like this:
I have tried with this code but when the player reaches the edge of the mesh it falls down:
TriangleSelector sel = device.SceneManager.CreateTriangleSelector(Program.field.currentScene.walkmeshLoaded, null);
CollisionResponseSceneNodeAnimator coll = device.SceneManager.CreateCollisionResponseAnimator(sel, playerNode);
playerNode.AddAnimator(coll);
coll.Drop();
sel.Drop();
I haven't used the system you are using but it's been two days so figured I'd give a shot in the dark. If I'm reading this correctly it sounds like you are using a pre-defined system and a mesh within it. When the player object goes to the edge of the mesh, it falls off the mesh, correct?
What it sounds like is happening is that the engine you are using has gravity of a sort, and that mesh is above the bottom level if there is one. Think of the mesh like a bridge; if you walk off the edge you fall off. What you may want to do is either setup walls along the edge of the mesh to prevent the player from falling off the bridge or, if the engine allows, setup collision on the mesh that prevents players from going over the edge. The later would be a better idea because I assume you're going to want enemies and NPCs to follow these same paths and walls are just more collision detecting (and could hamper things like flying enemies).
I know this isn't an exact answer, but I hope this gets a few ideas out there. Maybe I'm way off but this is what I'm thinking is going on from the information provided.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With