# Implementing Object Rotation Along Camera Axis

**URL:** <https://forums.unrealengine.com/t/implementing-object-rotation-along-camera-axis/2072949>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, question\
**Created:** [October 17, 2024, 4:33pm UTC](https://forums.unrealengine.com/t/implementing-object-rotation-along-camera-axis/2072949 "2024-10-17T16:33:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![giek0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@giek0](https://forums.unrealengine.com/u/giek0)\
**Post date:** [October 17, 2024, 4:33pm UTC](https://forums.unrealengine.com/t/implementing-object-rotation-along-camera-axis/2072949/1 "2024-10-17T16:33:30Z")

</div>

I’m implementing a feature where a player can examine an interacted object by rotating it, a common feature in many games. However, I’m struggling to get the rotation logic working correctly.

My goal is for the object to rotate right when the mouse moves right and up when the mouse moves up, regardless of the object’s current orientation. However, I’ve encountered issues with both world coordinates and local coordinates.

Using world coordinates, the rotation behavior changes depending on how the player interacts with the object, as shown in the video. Additionally, the Yaw movement isn’t what I’m aiming for.

Using local coordinates, the initial rotation is exactly what I want, as seen in the beginning of the video. However, as I rotate the object, the local axis shifts, causing the rotation to deviate from the desired behavior.

After researching, I discovered that I might be able to achieve the desired effect by multiplying the mouse input with the camera’s angle. However, even after setting up the blueprint as shown below, it still doesn’t work as intended.

 ![ItemRotation](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/7/7/37748bc4990a5500a6d1d6746a9c5791f5170e83.png)

I apologize for the unclear explanation. Any insights or suggestions that could help me solve this issue would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [October 17, 2024, 4:50pm UTC](https://forums.unrealengine.com/t/implementing-object-rotation-along-camera-axis/2072949/2 "2024-10-17T16:50:35Z")

</div>

You should be able to Add World Rotation, does this work for you?

> [@Rotate an object in all directions using the mouse](https://forums.unrealengine.com/t/rotate-an-object-in-all-directions-using-the-mouse/463545/2):
>
> Rotating an object is rather straighforward: [[Image from Gyazo]](https://gyazo.com/f1e0aae3a4e579adf7cb83323e43e9a1) After that, the user needs to be able to click on certain areas of the object Child Actors Components sound like the most obvious solution if the attached elements need to define their own unique logic. Depending on what is required (complexity of the shape of the object, modularity, scope) you could have sockets on a static mesh and add Child Actors Components procedurally. I can’t use the default templa…

---

<div class="post-metadata">

**Author:** ![Allenheathx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Allenheathx](https://forums.unrealengine.com/u/Allenheathx)\
**Post date:** [October 17, 2024, 6:19pm UTC](https://forums.unrealengine.com/t/implementing-object-rotation-along-camera-axis/2072949/3 "2024-10-17T18:19:30Z")

</div>

Im not sure of the details but you want to do it with world rotation not local

---

<div class="post-metadata">

**Author:** ![giek0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@giek0](https://forums.unrealengine.com/u/giek0)\
**Post date:** [October 20, 2024, 7:30am UTC](https://forums.unrealengine.com/t/implementing-object-rotation-along-camera-axis/2072949/4 "2024-10-20T07:30:16Z")

</div>

Thank you guys for your advise!  
As you suggested, I tried using Add World Rotation, but the object’s behavior remains unexpected, similar to when I was using Local.

 ![Rotation_World](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/3/1/931b5b0516dced94188fca492c4fa71540818c75.png)  

I believe the issue must be rooted in a different part of my code.  
I’ve reviewed the linked resource, but unfortunately, it didn’t provide a solution to my specific problem…

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [October 20, 2024, 11:39am UTC](https://forums.unrealengine.com/t/implementing-object-rotation-along-camera-axis/2072949/5 "2024-10-20T11:39:06Z")

</div>

> [@giek0](#):
>
> I’ve reviewed the linked resource, but unfortunately, it didn’t provide a solution to my specific problem…

Did you try to apply what was suggested in the thread, because what you’re showing combines the rotators unnecessarily…
