# Rotate object with mouse in Scene Capture 2D

**URL:** <https://forums.unrealengine.com/t/rotate-object-with-mouse-in-scene-capture-2d/608403>\
**Category:** Blueprint\
**Tags:** unreal-engine, UE5-0, Widget, Blueprint, question, UMG\
**Created:** [July 19, 2022, 10:31am UTC](https://forums.unrealengine.com/t/rotate-object-with-mouse-in-scene-capture-2d/608403 "2022-07-19T10:31:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdgfkf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jdgfkf](https://forums.unrealengine.com/u/jdgfkf)\
**Post date:** [July 19, 2022, 10:31am UTC](https://forums.unrealengine.com/t/rotate-object-with-mouse-in-scene-capture-2d/608403/1 "2022-07-19T10:31:47Z")

</div>

UE 5.0.3  
Hi,

So I have a inspection system allowing the user to inspect objects.

The object appears with a scene capture 2D rendered to a material and then on a image on the user widget.

I want to allow the user to rotate the object only when the mouse is hovering the object image and only when left mouse button is clicked.

I realized that the mouse hovering was not working anymore when LMB is pressed, so I tried to make a subwidget for the object image and tried with the mouse enter and mouse leave events, but they are not working also when LMB is pressed.

But also, when I just cut all that to test if the object is rotating wheter or not the user is clicking, the movement is jittery despite having the same code as if I was rotating a 3D object , with the mouse delta input. The scene capture is refreshing every frame, if I set an auto rotation function for instance, the rotation is smooth as expected.

Any ideas how I could achieve the clicking rotation on UI ?

Thanks

---

<div class="post-metadata">

**Author:** ![jdgfkf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jdgfkf](https://forums.unrealengine.com/u/jdgfkf)\
**Post date:** [July 19, 2022, 4:11pm UTC](https://forums.unrealengine.com/t/rotate-object-with-mouse-in-scene-capture-2d/608403/2 "2022-07-19T16:11:52Z")

</div>

By digging around a bit more, I realised that the problem might come from the get input mouse delta, it works fine out of the UI but once in the widget, it clearly tries to stay at 0 . Input is set to game and UI because if I select input mode to UI only, the LMB analog key state value stays at 1

---

<div class="post-metadata">

**Author:** ![jdgfkf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jdgfkf](https://forums.unrealengine.com/u/jdgfkf)\
**Post date:** [July 19, 2022, 7:11pm UTC](https://forums.unrealengine.com/t/rotate-object-with-mouse-in-scene-capture-2d/608403/3 "2022-07-19T19:11:11Z")

</div>

Solved with that

> [@Rotating 3d actor overlay inside widget with drag operation?](https://forums.unrealengine.com/t/rotating-3d-actor-overlay-inside-widget-with-drag-operation/529366/2):
>
> You need to use mouse move to achieve better results: On mouse down you save current mouse position, set some bool so mouse move function can calculate the change in drag, Mouse move you Get current mouse position and subtract it from old mouse position Mouse up you stop mouse move Here’s a working example I have, in the last image you see I’m using add local rotation to a spring arm so replace the spring arm with a mesh or whatever you want to rotate.
