# Rotating 3d actor overlay inside widget with drag operation?

**URL:** <https://forums.unrealengine.com/t/rotating-3d-actor-overlay-inside-widget-with-drag-operation/529366>\
**Category:** UI\
**Tags:** unreal-engine, Widget, UE4-27, question, UMG\
**Created:** [April 15, 2022, 10:59am UTC](https://forums.unrealengine.com/t/rotating-3d-actor-overlay-inside-widget-with-drag-operation/529366 "2022-04-15T10:59:16Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![isikdev](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/isikdev/32/991020_2.png) [@isikdev](https://forums.unrealengine.com/u/isikdev)\
**Post date:** [April 15, 2022, 10:59am UTC](https://forums.unrealengine.com/t/rotating-3d-actor-overlay-inside-widget-with-drag-operation/529366/1 "2022-04-15T10:59:16Z")

</div>

Hello fellow UE fam! I am trying to make a basic Character Pane that has the player character as a 2D Scene Capture material. I’ve managed to do that by spawning the Overlay actor somewhere in the world but I want the player to be able to rotate the rendered version of it from the UI. Basically, this is what I have:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/a/0/9a0f0bfabbf08f7b439fc5379d6f576326a7715d.jpeg)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/5/9/259b4a957bb5afc3676da31846fdf66cdf861576.png)

I also messed around with Drag and Drop but I’m not sure if that’s where I should handle this logic from. Currently I have something like this which allows me to rotate the spawned actor, therefore rotating the 2d capture version of it as well inside the UI: (excuse the mess, I haven’t slept for days)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/f/d/0fd42a819908adc302d4b40c4ceb1d2b72f0f418.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/8/5/c85566a97c83660929fa37cf1cd6f162a1fd87bb.png)

However it does not work as intended. It’s choppy because I believe I should be calling SetWorldRotation somewhere else but not sure where! Here’s what it feels like ingame:

[https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/9/a/99a2e5fd99110dd8ba932e22d2bc086caeec353d.mp4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/9/a/99a2e5fd99110dd8ba932e22d2bc086caeec353d.mp4)

Here I’m spamming left-click while trying to drag/rotate, and this is what I could achieve so far. How would I go about detecting the drag operation and rotate smoothly until MouseButton is up/not pressed? I suck at widgets so the more I learn the better! Appreciate it.

---

<div class="post-metadata">

**Author:** ![KaidoomDev](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kaidoomdev/32/977996_2.png) [@KaidoomDev](https://forums.unrealengine.com/u/KaidoomDev)\
**Post date:** [April 15, 2022, 11:10am UTC](https://forums.unrealengine.com/t/rotating-3d-actor-overlay-inside-widget-with-drag-operation/529366/2 "2022-04-15T11:10:04Z")

</div>

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.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/f/a/afaa6b5ca816684e8bfe1a01e667c5bd81bbc779.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/6/c/f6c8eeaa9ccc094ce9984aeb56fd30dea81a8760.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/b/2/6b27496f09b7f47e5d0b20920f9209eca5c637ea.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/c/e/ccee3a704170d6f4c7070ef23c1701e833d5e930.png)

---

<div class="post-metadata">

**Author:** ![isikdev](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/isikdev/32/991020_2.png) [@isikdev](https://forums.unrealengine.com/u/isikdev)\
**Post date:** [April 15, 2022, 11:11am UTC](https://forums.unrealengine.com/t/rotating-3d-actor-overlay-inside-widget-with-drag-operation/529366/3 "2022-04-15T11:11:49Z")

</div>

Amazing. Thank you very much mate. I will get on it asap. I tried some more stuff and this is my professional result:

[https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/f/0/7f091ca9851db60e5ab175f6048db59af71cc0da.mp4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/f/0/7f091ca9851db60e5ab175f6048db59af71cc0da.mp4)

Jokes aside, appreciate it. Trying it now! 😁

---

<div class="post-metadata">

**Author:** ![KaidoomDev](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kaidoomdev/32/977996_2.png) [@KaidoomDev](https://forums.unrealengine.com/u/KaidoomDev)\
**Post date:** [April 15, 2022, 11:12am UTC](https://forums.unrealengine.com/t/rotating-3d-actor-overlay-inside-widget-with-drag-operation/529366/4 "2022-04-15T11:12:23Z")

</div>

haha let me know how it goes.

---

<div class="post-metadata">

**Author:** ![isikdev](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/isikdev/32/991020_2.png) [@isikdev](https://forums.unrealengine.com/u/isikdev)\
**Post date:** [April 15, 2022, 11:21am UTC](https://forums.unrealengine.com/t/rotating-3d-actor-overlay-inside-widget-with-drag-operation/529366/5 "2022-04-15T11:21:10Z")

</div>

Works just as I wanted. Thank you so much! =)

---

<div class="post-metadata">

**Author:** ![KaidoomDev](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kaidoomdev/32/977996_2.png) [@KaidoomDev](https://forums.unrealengine.com/u/KaidoomDev)\
**Post date:** [April 15, 2022, 11:32am UTC](https://forums.unrealengine.com/t/rotating-3d-actor-overlay-inside-widget-with-drag-operation/529366/6 "2022-04-15T11:32:43Z")

</div>

You’re welcome.

---

<div class="post-metadata">

**Author:** ![GreeyaJini](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/greeyajini/32/618627_2.png) [@GreeyaJini](https://forums.unrealengine.com/u/GreeyaJini)\
**Post date:** [July 6, 2023, 7:31am UTC](https://forums.unrealengine.com/t/rotating-3d-actor-overlay-inside-widget-with-drag-operation/529366/7 "2023-07-06T07:31:00Z")

</div>

you did this in the BP class which contains the mesh you wanted u to rotate and created these function??

---

<div class="post-metadata">

**Author:** ![Axyzz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Axyzz](https://forums.unrealengine.com/u/Axyzz)\
**Post date:** [February 21, 2024, 11:57pm UTC](https://forums.unrealengine.com/t/rotating-3d-actor-overlay-inside-widget-with-drag-operation/529366/8 "2024-02-21T23:57:40Z")

</div>

Hi, can you help me, I’m trying to do the same thing, but I haven’t been successful yet, just let me see if I understand the solution that our friend posted here. The On mouse button up, On mouse button down and on mouse move functions are overrides, right? they are located in the blueprint widget that contains the image of the material, while the set mesh rotation function is created in the actor that has the 2d scene capture component. I literally did everything right but when trying to rotate it, it doesn’t rotate and I get an error that it was not possible to access the set mesh rotation.

---

<div class="post-metadata">

**Author:** ![Axyzz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Axyzz](https://forums.unrealengine.com/u/Axyzz)\
**Post date:** [February 22, 2024, 1:12am UTC](https://forums.unrealengine.com/t/rotating-3d-actor-overlay-inside-widget-with-drag-operation/529366/9 "2024-02-22T01:12:44Z")

</div>

Hi, can you help me, I’m trying to do the same thing, but I haven’t been successful yet, just let me see if I understand the solution. The On mouse button up, On mouse button down and on mouse move functions are overrides, right? they are located in the blueprint widget that contains the image of the material, while the set mesh rotation function is created in the actor that has the 2d scene capture component. I literally did everything right but when trying to rotate it, it doesn’t rotate and I get an error that it was not possible to access the set mesh rotation.

---

<div class="post-metadata">

**Author:** ![isikdev](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/isikdev/32/991020_2.png) [@isikdev](https://forums.unrealengine.com/u/isikdev)\
**Post date:** [February 23, 2024, 5:48pm UTC](https://forums.unrealengine.com/t/rotating-3d-actor-overlay-inside-widget-with-drag-operation/529366/10 "2024-02-23T17:48:27Z")

</div>

> [@Axyzz](#):
>
> I get an error that it was not possible to access the set mesh rotation.

If I recall correctly, “Set Mesh Rotation” here must be in the actor you’re working with. Accessed none means that you’re attempting to run this function in a null (invalid) object. Ensure it’s not invalid. If you can share your code I can perhaps help!

---

<div class="post-metadata">

**Author:** ![Axyzz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Axyzz](https://forums.unrealengine.com/u/Axyzz)\
**Post date:** [February 23, 2024, 6:33pm UTC](https://forums.unrealengine.com/t/rotating-3d-actor-overlay-inside-widget-with-drag-operation/529366/11 "2024-02-23T18:33:54Z")

</div>

Thanks for the answer, I managed to solve it, I realized that my widget didn’t find my object reference type variable from my actor preview, so what I did to solve it was go to event pre construct and use a get actor of class node and in the output promote for a variable, then it worked hahah  
Well, I still lack knowledge in knowing how to work with variables, but thanks for your help, I took a look at your channel and your games are incredible, congratulations!

---

<div class="post-metadata">

**Author:** ![isikdev](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/isikdev/32/991020_2.png) [@isikdev](https://forums.unrealengine.com/u/isikdev)\
**Post date:** [February 23, 2024, 8:49pm UTC](https://forums.unrealengine.com/t/rotating-3d-actor-overlay-inside-widget-with-drag-operation/529366/12 "2024-02-23T20:49:18Z")

</div>

Aw that means a lot. I’m glad you solved your issue. Thank you for the nice words! 💝

---

<div class="post-metadata">

**Author:** ![thuanly](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@thuanly](https://forums.unrealengine.com/u/thuanly)\
**Post date:** [February 27, 2024, 6:48am UTC](https://forums.unrealengine.com/t/rotating-3d-actor-overlay-inside-widget-with-drag-operation/529366/13 "2024-02-27T06:48:47Z")

</div>

thank you ,very suitable for my project

---

<div class="post-metadata">

**Author:** ![JasonKorda](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jasonkorda/32/898596_2.png) [@JasonKorda](https://forums.unrealengine.com/u/JasonKorda)\
**Post date:** [March 11, 2024, 1:57am UTC](https://forums.unrealengine.com/t/rotating-3d-actor-overlay-inside-widget-with-drag-operation/529366/14 "2024-03-11T01:57:25Z")

</div>

Hey! I’m having issues with the rotation 😕 I’m using “set relative rotation” instead of “add local rotation” because the result is much closer to what I’d like but each time I click, the actor goes back to its default rotation (0, 0, 0) then it starts rotating from that position. Is there a solution to this?

Using “add local rotation” makes the mesh rotate faster than light travels lol

---

<div class="post-metadata">

**Author:** ![RobotArtWorks](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RobotArtWorks](https://forums.unrealengine.com/u/RobotArtWorks)\
**Post date:** [June 20, 2024, 2:43pm UTC](https://forums.unrealengine.com/t/rotating-3d-actor-overlay-inside-widget-with-drag-operation/529366/15 "2024-06-20T14:43:05Z")

</div>

![Screenshot 2024-06-20 135117](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/8/c/78ca2adeee8ec7a895aca250f06d960c2de2de5b.png)  
Try This
