# how to switching interactorStyle?

**URL:** <https://discourse.vtk.org/t/how-to-switching-interactorstyle/5135>\
**Category:** Development\
**Created:** [February 4, 2021, 4:12am UTC](https://discourse.vtk.org/t/how-to-switching-interactorstyle/5135 "2021-02-04T04:12:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhp](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/j/d78d45/32.png) [@jhp](https://discourse.vtk.org/u/jhp)\
**Post date:** [February 4, 2021, 4:12am UTC](https://discourse.vtk.org/t/how-to-switching-interactorstyle/5135/1 "2021-02-04T04:12:30Z")

</div>

1. 3 objects receive the trackballcamera event (simultaneous rotation).
2. Select object #1. (pickingInteratorStyle definition)
3. Only object 1 is rotated. (trackballActor applied)
4. After deselecting object 1, the 3 objects rotate together.

After selecting an object, it is successful to rotate only the selected object.  
How do I make 3 objects rotate at the same time after deselecting

//customize interactorstyle  
class pickingInteractorStyle : public vtkInteractorStyleTrackballCamera  
{  
public:  
static pickingInteractorStyle\* New();  
vtkTypeMacro(pickingInteractorStyle, vtkInteractorStyleTrackballCamera);

```
virtual void OnLeftButtonDown() override
{
		int* clickPos = this->GetInteractor()->GetEventPosition();

		// Pick from this location.
		vtkNew<vtkPropPicker> picker;

		auto pickedActor = picker->GetActor();
		
		//select actor & change interactor style
		 if (pick_1 == pickedActor)
		{
			vtkNew<vtkInteractorStyleTrackballActor> style;					
			this->Interactor->SetInteractorStyle(style);
		}
}
virtual void OnLeftButtonDown() override
{
	//deselect object & 3 objects rotate....
}

```

}

vtkNew style;  
style-\>SetDefaultRenderer(renderer);  
renderWindowInteractor-\>SetInteractorStyle(style);  
style-\>pick\_1 = actor\_1;

---

<div class="post-metadata">

**Author:** ![BadCookie](https://discourse.vtk.org/user_avatar/discourse.vtk.org/badcookie/32/3603_2.png) [@BadCookie](https://discourse.vtk.org/u/BadCookie)\
**Post date:** [July 26, 2021, 12:18pm UTC](https://discourse.vtk.org/t/how-to-switching-interactorstyle/5135/2 "2021-07-26T12:18:46Z")

</div>

@jhp

Hello,  
I’m trying to do the exact same thing, want to know if you found out a way to do it ?

Thanks
