Wall Collision and Detection


I’m trying to recreate same feature like in this reference video:

Basically, I have game objects that I’m moving with mouse movement (no rigid bodies), once I detect wall, I want to apply the normal vector to affect the direction and stop moving the game object through walls.
What is the best way to create this?


cc @Cedric as he is a wizard with those use cases

cc @echadwick-wayfair who might be happy to see ppl reusing the same UX :slight_smile:

1 Like


In this case we know the dimensions of our room, so we can simply limit the transforms using the furniture’s bounding box.

We have different classes of assets too, each with different behaviors. So wall mirrors for example will stay on walls, and never go on floors or ceilings.

But for a more general use case it would probably make more sense to use physics instead.


I would try something really simple. with an onBeforeRender observable, and clamp mesh position. as simple as it can get.


Thanks everyone for your feedback! I will try what you guys have suggested

1 Like