# Collision mask on arc rotate camera

**URL:** <https://forum.babylonjs.com/t/collision-mask-on-arc-rotate-camera/26560>\
**Category:** Questions\
**Created:** [January 7, 2022, 10:55pm UTC](https://forum.babylonjs.com/t/collision-mask-on-arc-rotate-camera/26560 "2022-01-07T22:55:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Censor](https://avatars.discourse-cdn.com/v4/letter/c/8e7dd6/32.png) [@Censor](https://forum.babylonjs.com/u/Censor)\
**Post date:** [January 7, 2022, 10:55pm UTC](https://forum.babylonjs.com/t/collision-mask-on-arc-rotate-camera/26560/1 "2022-01-07T22:55:44Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [January 10, 2022, 3:15pm UTC](https://forum.babylonjs.com/t/collision-mask-on-arc-rotate-camera/26560/2 "2022-01-10T15:15:31Z")

</div>

Adding @PolygonalSun for cameras

---

<div class="post-metadata">

**Author:** ![PolygonalSun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polygonalsun/32/2704_2.png) [@PolygonalSun](https://forum.babylonjs.com/u/PolygonalSun)\
**Post date:** [January 10, 2022, 5:05pm UTC](https://forum.babylonjs.com/t/collision-mask-on-arc-rotate-camera/26560/3 "2022-01-10T17:05:11Z")

</div>

If you enable `checkCollisions` for both your ArcRotateCamera and the desired meshes, it should stop your camera from passing though those meshes.

```auto
// Example
camera.checkCollisions = true;

```

---

<div class="post-metadata">

**Author:** ![Censor](https://avatars.discourse-cdn.com/v4/letter/c/8e7dd6/32.png) [@Censor](https://forum.babylonjs.com/u/Censor)\
**Post date:** [January 10, 2022, 5:32pm UTC](https://forum.babylonjs.com/t/collision-mask-on-arc-rotate-camera/26560/4 "2022-01-10T17:32:55Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Censor](https://avatars.discourse-cdn.com/v4/letter/c/8e7dd6/32.png) [@Censor](https://forum.babylonjs.com/u/Censor)\
**Post date:** [January 12, 2022, 8:24am UTC](https://forum.babylonjs.com/t/collision-mask-on-arc-rotate-camera/26560/5 "2022-01-12T08:24:03Z")

</div>

Is this possible or is it perhaps better to just raycast to the camera pos or something?

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [January 12, 2022, 11:38am UTC](https://forum.babylonjs.com/t/collision-mask-on-arc-rotate-camera/26560/6 "2022-01-12T11:38:25Z")

</div>

Could you set `checkCollisions` just for the meshes you want to collide with the camera?

---

<div class="post-metadata">

**Author:** ![Censor](https://avatars.discourse-cdn.com/v4/letter/c/8e7dd6/32.png) [@Censor](https://forum.babylonjs.com/u/Censor)\
**Post date:** [January 12, 2022, 3:33pm UTC](https://forum.babylonjs.com/t/collision-mask-on-arc-rotate-camera/26560/7 "2022-01-12T15:33:57Z")

</div>

Unfortunately that’s not possible since the meshes need to collide with each other…

---

<div class="post-metadata">

**Author:** ![PolygonalSun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polygonalsun/32/2704_2.png) [@PolygonalSun](https://forum.babylonjs.com/u/PolygonalSun)\
**Post date:** [January 13, 2022, 12:30am UTC](https://forum.babylonjs.com/t/collision-mask-on-arc-rotate-camera/26560/8 "2022-01-13T00:30:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Censor](https://avatars.discourse-cdn.com/v4/letter/c/8e7dd6/32.png) [@Censor](https://forum.babylonjs.com/u/Censor)\
**Post date:** [January 13, 2022, 7:49am UTC](https://forum.babylonjs.com/t/collision-mask-on-arc-rotate-camera/26560/9 "2022-01-13T07:49:55Z")

</div>

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.
