Move width detect collision

I’m looking for a solution to move with detect walls.
Now i came up with a solution:
I add to the group 4 meshes on each side and detect collision all of this meshes width walls.
if rightside children of group collision with wall i stoped “rightmove” and so on.

its work! But i think this is not good solution))
example with my solution:

1 Like

Detection collision can be done in many, many ways.

For example if you approximate your cube with an AABB and your walls with simple planes, it’s possible to perform very fast collision detection via a basic AABB/plane intersection tests. Another option is to put at each side of your cube a ray and perform ray intersection tests with the geometry of your wall. This approach is more flexibel but also more costly.

An other option from game development is to use a navigation mesh in order to restrict the movement of game entities or the player in a modern fashion. There are a lot of scenarios where such an approach is sufficient (and faster) than using a collider system or physics engine. And it can be also used for pathfinding (well, that is the primary purpose of a nav mesh^^).


As @Mugen87 says, there are many ways to solve this. I played with this a while ago and you can see a couple of tutorials here: Lessons 30 and 32 cover both collision and hit-detection, FWIW.

1 Like