move single actor out of multiple actors in a renderer

Hello,

I have a renderWindow in vtk.js with two actors (vtkImageSlice and vtkActor). I want to change the position and orientation of vtkActor with cylinder source using user interaction like mouse click and drag. I can manually change the position of cylinder in the code by changing the x,y,z values and add the actor in the scene but I want to perform this using an interaction. Kindly suggest me any widget or interaction I can use to move the individual actor inside a renderWindow.

Thanks

you can use ‘vtkInteractorStyleTrackballActor’ , you can find it in the examples.

1 Like

Thanks for the reply. I was able to find vtkInteractorStyleTrackballActor in C++ but not in VTK.js. I am developing a web application using ReactJs and VTK.js

I almost did not notice your post as it was not in the web section. :wink:
You should be able to easily port the C++ version of that interactor style as the classes are very similar to the C++.

Or you can create your own widget with the new vtk.js widget infrastructure.

1 Like

Thanks Sebastien, I will try that.

Hello,

I am completely new to vtk.js. Can you please share some link where I can find “How to change position of actor manually” or Can you share your code?
I know it is a silly question, but It helps me a lot.

actor.setPosition(x, y, z)

2 Likes