Hi, I’m trying to stop an arc rotate camera from colliding with certain meshes.
Is it possible to achieve this using a collision mask as you can do with a mesh?
Or is there a different way of doing this?
Adding @PolygonalSun for cameras
If you enable checkCollisions
for both your ArcRotateCamera and the desired meshes, it should stop your camera from passing though those meshes.
// Example
camera.checkCollisions = true;
Sorry, I see that my post may be confusing.
I want the camera to pass through some meshes, but not all of them (for example, I do want collisions between the camera and the ground).
For meshes, I can set a collision mask and collision groups. I do not see this functionality on the camera. Is there another way to achieve this?
Is this possible or is it perhaps better to just raycast to the camera pos or something?
Could you set checkCollisions
just for the meshes you want to collide with the camera?
Unfortunately that’s not possible since the meshes need to collide with each other…
It might require a bit of custom movement code but what about parenting the camera to a mesh and moving the mesh? The custom movement code would make the mesh move like the ArcRotateCamera. Either that or add a mesh to surround the camera and when a mesh with a specific mask intersects the camera’s outer mesh, set checkCollisions
on the camera to true.
That’s some creative ideas, I’ll try adding a surrounding mesh for the camera and see if I can get the collisions to work that way.