Prevent Camera Collision with other Meshes

Hi,

I need to do the same like the project below.

I already did like this camera using our FreeCamera. But It is entering into the meshes what are all available at the scene. But in this sample website, Camera is stopping before colliding with other meshes. How to do this? kindly help me on this.

I tried like this,

But, At some place of collision, automatically my camera position movement has been stuckup. But the rotation with mouse event is working properly.

What do you mean by “stuckup”?

@carolhmj Just hang with the keyboard control. After that, Keyboard control is not working anymore

Again, what exactly is the meaning of “hang” in this context? If I collide with a mesh in your Playground, I can’t walk forwards on that direction, obviously, but I can still walk backwards or sidewards.

1 Like

Yeah. But I can’t walk even backwards or sidewards also.

I’m not experiencing this. What browser are you using?

I hope this simplest example will help - https://playground.babylonjs.com/#0VHCTL#26

3 Likes

That simple example already works quite fine with this scene. I’d say it’s already a good base for this use case.

Thanks a lot @labris Exactly this is what I need. I am trying to implement this in my project. I will let you know, if I face any difficulties.