# How to rotate an actor not using its axis?

**URL:** <https://forums.unrealengine.com/t/how-to-rotate-an-actor-not-using-its-axis/1752754>\
**Category:** Blueprint\
**Tags:** unreal-engine, question\
**Created:** [March 14, 2024, 11:30pm UTC](https://forums.unrealengine.com/t/how-to-rotate-an-actor-not-using-its-axis/1752754 "2024-03-14T23:30:11Z")\
**Posts on this page:** 20\
**Page:** 1

<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 14, 2024, 11:30pm UTC](https://forums.unrealengine.com/t/how-to-rotate-an-actor-not-using-its-axis/1752754/1 "2024-03-14T23:30:11Z")

</div>

Hello! I’m doing a menu like the one in the video below in my project, but the actors don’t rotate the way I want them to.

I don’t want to use the actor’s axis’ but their relative position to the viewport. There’s a video below for reference, from Resident Evil 3, in which you can see what I mean. No matter the actor’s rotation, it always rotates to the left/right or top/bottom of the screen, not in the rotation relative to the item. Please help I’ve been trying to figure this out for about a week now…

---

<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:** [March 15, 2024, 12:50am UTC](https://forums.unrealengine.com/t/how-to-rotate-an-actor-not-using-its-axis/1752754/2 "2024-03-15T00:50:43Z")

</div>

Something like this?

> [@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:** ![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 15, 2024, 11:40am UTC](https://forums.unrealengine.com/t/how-to-rotate-an-actor-not-using-its-axis/1752754/3 "2024-03-15T11:40:34Z")

</div>

Yes! I tried to replicate what you posted there but it doesn’t rotate at all. Here’s what my current code looks like:

This is in the widget:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/a/7/da78e73db18f5cd1d03ed310eab4c30e0022b592.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/5/4/a54629c415545ceb1bd9f94c5f37b521b83a9724.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/3/2/032471b690bd8cb343c1cdd7f7b6fd3279713ff3.png)

And this is in parent actor blueprint:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/6/6/6660dd67a23d0dd5342295647cb33517028296f4.png)

Like I said I tried replicating it but does not work, rotation is always 0.

Also, this is what the actor looks like:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/4/e/e4ef69502f7f1243b3a69cf14ed1fe276ba304d2.jpeg)

---

<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:** [March 15, 2024, 11:49am UTC](https://forums.unrealengine.com/t/how-to-rotate-an-actor-not-using-its-axis/1752754/4 "2024-03-15T11:49:08Z")

</div>

Either query mouse position in the widget or in the controller. Don’t mix both. If you need mouse delta in the widget:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/0/5/b05f0ac0af4d56e62ad8a60278ac48252a5cc198.png)

* * *

On a somewhat unrelated note:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/f/7/df7422fb68b9dd3f68e2ef9780432c7ab09e601a.jpeg)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/b/3/3b304d2ab9e58c5db21473f65513c9e93a91df1f.png)

`OnMouseMove` executes every frame. Avoid calling it here. Cache the actors elsewhere perhaps?

---

<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 15, 2024, 11:55am UTC](https://forums.unrealengine.com/t/how-to-rotate-an-actor-not-using-its-axis/1752754/5 "2024-03-15T11:55:22Z")

</div>

This worked!! Only issue it moves VERY fast lol. How should I speed it down?

And the get all actors thing was the easy way to do so, since only the item that I want to examine gets spawned and then destroyed when that widget closes. Is it still a problem even if that’s how I’ve set it to work?

---

<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:** [March 15, 2024, 12:03pm UTC](https://forums.unrealengine.com/t/how-to-rotate-an-actor-not-using-its-axis/1752754/6 "2024-03-15T12:03:11Z")

</div>

You could multiply delta by a \< 1 factor:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/2/c/62ce54fe109f752e1ad2c650479ed240e9d97980.png)

---

<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 15, 2024, 12:07pm UTC](https://forums.unrealengine.com/t/how-to-rotate-an-actor-not-using-its-axis/1752754/7 "2024-03-15T12:07:09Z")

</div>

Thank you!!! You’ve been so helpful these past few days, I really appreciate it. Would you happen to know how could I use a gamepad to rotate the actor too?

---

<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:** [March 15, 2024, 12:09pm UTC](https://forums.unrealengine.com/t/how-to-rotate-an-actor-not-using-its-axis/1752754/8 "2024-03-15T12:09:27Z")

</div>

Enhanced Input works well in widgets. I’d use that. It can even spit out a swizzled ready-to-go value.

> And the get all actors thing was the easy way to do so, since only the item that I want to examine gets spawned and then destroyed when that widget closes.

I’d probably push a ref to the widget. If can take a performance hit, it’s up to you. Since there’s only one, perhaps this is enough:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/7/b/c7b25dcbd01e46a989f6ba844e40a019e3ddc68d.png)

At least no need need of a loop. Probably irrelevant.

---

<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 15, 2024, 12:12pm UTC](https://forums.unrealengine.com/t/how-to-rotate-an-actor-not-using-its-axis/1752754/9 "2024-03-15T12:12:49Z")

</div>

I did this and the cube started rotating by itself hahaha

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/f/0/6f04a96e838a3bf06666a27681d816ed61125d5b.png)

---

<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:** [March 15, 2024, 12:16pm UTC](https://forums.unrealengine.com/t/how-to-rotate-an-actor-not-using-its-axis/1752754/10 "2024-03-15T12:16:51Z")

</div>

That 👆 is not [Enhanced Input](https://docs.unrealengine.com/5.0/en-US/enhanced-input-in-unreal-engine/), though. This is:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/4/c/f4c7dd3f9f190a78b6d35867d73bc6155ba87b4d.png)

Those pins only fire when certain configurable conditions are met.

* * *

You could still use the legacy system, you just need to gate it (because it (again) executes every frame)), something close to:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/2/3/9234956364900784970787626466e34ea136571d.png)

---

<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 15, 2024, 12:34pm UTC](https://forums.unrealengine.com/t/how-to-rotate-an-actor-not-using-its-axis/1752754/11 "2024-03-15T12:34:35Z")

</div>

Second option doesn’t seem to work because of this

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/3/1/33155754147da651ce6ee573db4b2debfd36688f.png)

How should I set the enhanced input? I have not gone further than using triggered, started and completed with those

---

<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:** [March 15, 2024, 1:24pm UTC](https://forums.unrealengine.com/t/how-to-rotate-an-actor-not-using-its-axis/1752754/12 "2024-03-15T13:24:30Z")

</div>

> [@JasonKorda](#):
>
> I did this and the cube started rotating

But you had it working there!

* * *

> [@JasonKorda](#):
>
> set the enhanced input?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/4/a/44a1eb692027959f50be997eae929e67e90e9fb8.png)

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/1/8/1186c0a6da83882d921bcae7a78a3d3b51307c93.png)

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/f/1/4f1144f1c78ad4ba597e60c33acc8f52a072c00d.png)

Triggered fires only when you fiddle with the stick. You can play with axi negation in case you want another direction.

---

<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 15, 2024, 1:37pm UTC](https://forums.unrealengine.com/t/how-to-rotate-an-actor-not-using-its-axis/1752754/13 "2024-03-15T13:37:08Z")

</div>

Enhanced input doesn’t work either 🤨 I’ve linked it to a print string but doesn’t fire

---

<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:** [March 15, 2024, 1:37pm UTC](https://forums.unrealengine.com/t/how-to-rotate-an-actor-not-using-its-axis/1752754/14 "2024-03-15T13:37:31Z")

</div>

Did you add mapping context and all?

---

<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 15, 2024, 1:38pm UTC](https://forums.unrealengine.com/t/how-to-rotate-an-actor-not-using-its-axis/1752754/15 "2024-03-15T13:38:11Z")

</div>

Yes! I also added the modifier to the context to try to make it work

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/9/3/e93dc27f4672c7ec452f1785ca2fd81326ec9567.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/1/a/b1a8a59d11b4583f21ef5b0d03946044df09920c.png)

---

<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:** [March 15, 2024, 1:41pm UTC](https://forums.unrealengine.com/t/how-to-rotate-an-actor-not-using-its-axis/1752754/16 "2024-03-15T13:41:14Z")

</div>

In which blueprint and how did you add the mapping context?

---

<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 15, 2024, 1:44pm UTC](https://forums.unrealengine.com/t/how-to-rotate-an-actor-not-using-its-axis/1752754/17 "2024-03-15T13:44:13Z")

</div>

This is how it’s added to my TPC

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/a/b/aab694fac42c8e4157f05abad206fea86cca6fc0.png)

Do I have to add it anywhere else?

---

<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:** [March 15, 2024, 1:57pm UTC](https://forums.unrealengine.com/t/how-to-rotate-an-actor-not-using-its-axis/1752754/18 "2024-03-15T13:57:37Z")

</div>

And the Input Actions never trigger? Even outside the widgets?

---

<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 15, 2024, 2:00pm UTC](https://forums.unrealengine.com/t/how-to-rotate-an-actor-not-using-its-axis/1752754/19 "2024-03-15T14:00:07Z")

</div>

If I place that input action in the character blueprint it triggers infinitely after i’ve moved the left thumbstick, even after I stop

---

<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:** [March 15, 2024, 2:06pm UTC](https://forums.unrealengine.com/t/how-to-rotate-an-actor-not-using-its-axis/1752754/20 "2024-03-15T14:06:06Z")

</div>

But that’s not how IA works, hm. It only triggers when the input is down. Can you test it with a keyboard key? What are the chances the pad is drifting and keeps sending values?

I have an old thing here and every now and then, when plugged in, it will randomly start rotating the camera, giving me the heebie-jeebies.

[Next page](https://forums.unrealengine.com/t/how-to-rotate-an-actor-not-using-its-axis/1752754.md?page=2)
