I’m wondering about some collisions of a platform game. One thing I was wondering, could a level like houses, etc, be a ground mesh if they were all joined together as one mesh?
Another thing, how would I tell the difference of a player being on top of a mesh, as opposed to running in to it sideways?
What is the most efficient way to check collisions? Is there some way of cancelling out objects that probably won’t collide in the check?
Babylon’s collision system works well with relatively large meshes it is however better to separate them into different meshes where possible so that the collision system will not require to check for collisions on objects that might hurt performance.
The collision system also does the job for you when it comes to filtering objects that are out of the bounds of the colliding object.
The collision system also has a simple gravity feature, which will cause a mesh that is moved using moveWithCollision
to slowly drop down (if gravity is negative on Y). It will however not let you go through a wall, if this wall is set as a collision mesh. The onCollide callback will provide you with which mesh was the object collided against.
This is not physics-based collision thou. If you need physics, you will need to enable a physics engine. In that case, it all depends on the engine you select and how you define the impostors.
OK, thanks. If I got it right, I just use a ground plane for the ground, and if I have towers and such, separate them and add them all to the collision system. Use moveWithCollision for all motion. That gives me a good starting point. I would rather start with the collision system.