# vtk.js interactorStyleManipulator constrain rotation

**URL:** https://discourse.vtk.org/t/vtk-js-interactorstylemanipulator-constrain-rotation/6712
**Category:** Web
**Created:** [September 28, 2021, 8:58am UTC](https://discourse.vtk.org/t/vtk-js-interactorstylemanipulator-constrain-rotation/6712 "2021-09-28T08:58:27Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![siebe](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/6bbea6/32.png) [@siebe](https://discourse.vtk.org/u/siebe)
#### Post date: [September 28, 2021, 8:58am UTC](https://discourse.vtk.org/t/vtk-js-interactorstylemanipulator-constrain-rotation/6712/1 "2021-09-28T08:58:27Z")

</div>

Hi,

I’m using a `vtkRenderWindowInteractor` with the `vtkInteractorStyleManipulator` style applied to it. This allows to rotate the 3D view using mouse gestures.

I was wandering if there is a way to constrain the 3D rotation of the interactor in such a way that the horizon of the camera stays horizontal. In other words, dragging the mouse should allow for yawing and pitching but not rolling (there is a separate shortcut for that). Some pictures to illustrate:

- Default orientation:  
 ![image](https://discourse.vtk.org/uploads/default/original/2X/c/c33734b935457d7631761a3fd4c68bd12ddb55f1.jpeg)
- Dragging to the left results in a yaw:  
 ![image](https://discourse.vtk.org/uploads/default/original/2X/f/fd957fd2d3b4619f93049148426f8afab5bcea09.jpeg)
- Dragging downwards results in a pitch:  
 ![image](https://discourse.vtk.org/uploads/default/original/2X/7/7633022f4690fcdbb4bcf134998883e3fba3ccca.jpeg)
- This should not be allowed (camera is rolled):  
 ![image](https://discourse.vtk.org/uploads/default/original/2X/7/75dabfe78cf65f942c6c23644ad580e1f6e06e77.jpeg)

Thanks a lot for the help!

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [September 28, 2021, 2:38pm UTC](https://discourse.vtk.org/t/vtk-js-interactorstylemanipulator-constrain-rotation/6712/2 "2021-09-28T14:38:45Z")

</div>

I think [this is](https://github.com/Kitware/vtk-js/tree/master/Sources/Interaction/Manipulators/MouseCameraAxisRotateManipulator) what you are looking for.

---

<div class="post-metadata">

### Author: ![siebe](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/6bbea6/32.png) [@siebe](https://discourse.vtk.org/u/siebe)
#### Post date: [September 30, 2021, 12:37pm UTC](https://discourse.vtk.org/t/vtk-js-interactorstylemanipulator-constrain-rotation/6712/3 "2021-09-30T12:37:40Z")

</div>

This is exactly what I was looking for indeed. Thanks a lot.
