# how to translate operation actors on plane actor

**URL:** https://discourse.vtk.org/t/how-to-translate-operation-actors-on-plane-actor/13125
**Category:** Support
**Tags:** python
**Created:** [January 23, 2024, 10:27am UTC](https://discourse.vtk.org/t/how-to-translate-operation-actors-on-plane-actor/13125 "2024-01-23T10:27:46Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![thecoderMCV](https://discourse.vtk.org/user_avatar/discourse.vtk.org/thecodermcv/32/8347_2.png) [@thecoderMCV](https://discourse.vtk.org/u/thecoderMCV)
#### Post date: [January 23, 2024, 10:27am UTC](https://discourse.vtk.org/t/how-to-translate-operation-actors-on-plane-actor/13125/1 "2024-01-23T10:27:46Z")

</div>

hi there,

I want to move the actor on a plane I created on scene with the mouse, that is translate.  
I developed this in the code below, but when I select the actor and start the movement, the mouse and the actor cannot be in the same position. I can say more detailed as follows.

```auto
        camera = renderer.GetActiveCamera()
        view_focus = camera.GetFocalPoint()

        temp_out = [0, 0, 0]
        compute_world2display(renderer, view_focus[0], view_focus[1], view_focus[2], temp_out)
        focal_depth = temp_out[2]

        first_pick_point = [0, 0, 0, 0]
        last_pick_point = [0, 0, 0, 0]
        x, y = interactor.GetEventPosition()
        x_, y_ = interactor.GetLastEventPosition()
        compute_display2world(renderer, x, y, focal_depth, first_pick_point)
        compute_display2world(renderer, x_, y_, focal_depth, last_pick_point)

        start_position_3d = np.array(first_pick_point[:3])
        end_position_3d = np.array(last_pick_point[:3])

        delta = np.array(start_position_3d) - end_position_3d
        view_normal = np.array(renderer.GetActiveCamera().GetViewPlaneNormal())
        delta_inplane = delta - view_normal * np.dot(delta, view_normal)
        delta_inplane[2] = 0

        for actor in selected_actors:
            actor_transform = actor.GetUserTransform()
            if not actor_transform:
                actor_transform = vtkTransform()
            actor_transform.Translate(delta_inplane)
            actor.SetUserTransform(actor_transform)

```

When I click on the actor with the mouse and move it to the top right, the actor stays behind and the mouse stays ahead. There is no exact proportion.  
Since I wanted to do this on x and y axis, I set z equal to 0.

I looked at previous threads and github. I didn’t see a clear solution.

---

<div class="post-metadata">

### Author: ![thecoderMCV](https://discourse.vtk.org/user_avatar/discourse.vtk.org/thecodermcv/32/8347_2.png) [@thecoderMCV](https://discourse.vtk.org/u/thecoderMCV)
#### Post date: [January 23, 2024, 10:31am UTC](https://discourse.vtk.org/t/how-to-translate-operation-actors-on-plane-actor/13125/2 "2024-01-23T10:31:46Z")

</div>

> **[move\_problem.mp4](https://drive.google.com/file/d/13QmBfhokvSB5wghIy-CyVYHlKdDxHcqg/view?usp=sharing)**
>
> Google Drive file.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [February 7, 2024, 2:15pm UTC](https://discourse.vtk.org/t/how-to-translate-operation-actors-on-plane-actor/13125/3 "2024-02-07T14:15:16Z")

</div>

Hello,

> [@thecoderMCV](#):
>
> when I select the actor and start the movement, the mouse and the actor cannot be in the same position

I fear I didn’t understand this. If you select an actor, then I suppose the mouse pointer is within the actor’s boundaries in screen coordinates.

> [@thecoderMCV](#):
>
> I click on the actor with the mouse and move it to the top right, the actor stays behind and the mouse stays ahead.

Isn’t this the expected behavior? I mean, when I use Windows the mouse pointer is always on top anything else.

regards,

PC
