I try to make a simple 2D game, where the collision is handled by simple shapes. This is why I thought, that it wouldn’t be necessary to use a custom physics-engine and went with the default one.
I set up a simple playground just containing a collision box and a smaller box with input-controls: Babylon.js Playground
After reading about collision in the documentation, I think the moveWithCollisions
function is what I need, but the result differs from what I expected in two ways:
-
when moving closely around the corners of the big box, the player moves in a circular way and not like it is moving around a corner. (even if the player is a cube)
-
when trying to touch the wall with the long side of the player, it always stops with some distance. (this is not the case, if the player is a cube)
Did I do something wrong, do I have to use a custom physics engine or is there some easy way to get it working?