The camera moves out of the room

Hello everyone. In third person view, I would not want the camera to fly through the wall. I would like it to always remain indoors and scaled if i hit the wall with the camera. What are the options to achieve this?

https://playground.babylonjs.com/#LA72BF

I think you want to enable collisions: Camera Collisions | Babylon.js Documentation

1 Like

I tried to enable collisions but they don’t work. I think it has something to do with the fact that I have Ammo and physical impostors turned on.

I don’t know physics, but I guess that if it is enabled, all collisions must go through this layer.

1 Like

Adding @Cedric who can help regarding this issue and yes in case of imposters it will take over the collisions :slight_smile:

1 Like

You have to enable collsions on the camera and on the meshes. Once done, it works:

The camera doesn’t move out of the room | Babylon.js Playground

1 Like