# Wrong rotation

**URL:** <https://forums.unrealengine.com/t/wrong-rotation/571626>\
**Category:** Mobile\
**Tags:** unreal-engine, UE5-0, Android, question\
**Created:** [June 1, 2022, 2:33pm UTC](https://forums.unrealengine.com/t/wrong-rotation/571626 "2022-06-01T14:33:15Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Taracast](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Taracast](https://forums.unrealengine.com/u/Taracast)\
**Post date:** [June 1, 2022, 2:33pm UTC](https://forums.unrealengine.com/t/wrong-rotation/571626/1 "2022-06-01T14:33:15Z")

</div>

Hi.  
I’m loading level instance with transformation. That level has character and some objects. If you tap on object char should look on it.  
When level spawning with rotation of 180° +/- char starting to rotate strangly.

 ![init](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/c/9/ec9521742b01c4703cf9a3b10176e00f98930fe1.png)

If you tap on A char will turn around. If after tap on B char will turn around again. But if after B you tap on C all ok.

Rotate by using “Find look at roration” and lerp (lerp only Z or by full vector, no mater).  
Using “Get world location / rotation”.  
Notice that if char rotation is positive, target rotation negative and vice a versa.

How to fix this?

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [June 1, 2022, 3:04pm UTC](https://forums.unrealengine.com/t/wrong-rotation/571626/2 "2022-06-01T15:04:38Z")

</div>

Can you show the code? ( are you using a timeline? )

---

<div class="post-metadata">

**Author:** ![Taracast](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Taracast](https://forums.unrealengine.com/u/Taracast)\
**Post date:** [June 2, 2022, 6:33am UTC](https://forums.unrealengine.com/t/wrong-rotation/571626/3 "2022-06-02T06:33:00Z")

</div>

Changed logic to this:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/4/f/94f02a793d4996b703d1f4f9c5b7ead227408fb4.png)

Timeline from (0,0) to (1,1).

And test level:

 ![init](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/9/6/e968180a08feb73847e93ae8f390378b06e13582.png)

If tap between A and B char will turn around.

Notice that even without initial level rotation char has same behavior for two cornered targets. Only for two.

Problen in rotation calculation?

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [June 2, 2022, 6:52am UTC](https://forums.unrealengine.com/t/wrong-rotation/571626/4 "2022-06-02T06:52:10Z")

</div>

Ok, there’s two things:

1. In a timeline, you have to pre-calculate all coordinates before going into the timeline. You’re sampling the actor rotation during the timeline, which will give you all kinds of weirdness. And possibly this along will solve your problem.

2. Almost all the rotation nodes in blueprint suffer from the problem that the engine likes to correct 180 to -180 and vice versa. There are two ways around this I know, Quaternions, or using rinterp ( in some circumstances ). So, have a go with (1) above, and if this doesn’t solve it, I’ll show you the rinterp method.

---

<div class="post-metadata">

**Author:** ![Taracast](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Taracast](https://forums.unrealengine.com/u/Taracast)\
**Post date:** [June 2, 2022, 7:14am UTC](https://forums.unrealengine.com/t/wrong-rotation/571626/5 "2022-06-02T07:14:06Z")

</div>

I pre calculate rotations before timeline. Inside it I only use lerp with this values. Problem is still there.

On level without transform (we should forget about transform, problem exist even without it):  
at init char look at forward (top) obj, rotation = 0  
for backward (bottom) obj rotation = 180  
for left obj rotation = -90

P.S. Animation become slo-o-o-ow )

---

<div class="post-metadata">

**Author:** ![Taracast](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Taracast](https://forums.unrealengine.com/u/Taracast)\
**Post date:** [June 2, 2022, 7:41am UTC](https://forums.unrealengine.com/t/wrong-rotation/571626/6 "2022-06-02T07:41:56Z")

</div>

Somehow I fixed this!

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

But I lilbit misunderstand how RinterpTo work. Why if I set InterpSpeed to 0, char will teleport to target rotation ignoring timeline?

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [June 2, 2022, 7:42am UTC](https://forums.unrealengine.com/t/wrong-rotation/571626/7 "2022-06-02T07:42:33Z")

</div>

So, it’s basically this

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/d/2/9d22bfa21427d4edbcb5a487018fc5b88bc39aaf.png)

---

<div class="post-metadata">

**Author:** ![Taracast](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Taracast](https://forums.unrealengine.com/u/Taracast)\
**Post date:** [June 2, 2022, 7:46am UTC](https://forums.unrealengine.com/t/wrong-rotation/571626/8 "2022-06-02T07:46:47Z")

</div>

Thanks for the help!

In my variant, timeline become something like EventTick )

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [June 2, 2022, 7:47am UTC](https://forums.unrealengine.com/t/wrong-rotation/571626/9 "2022-06-02T07:47:04Z")

</div>

Timelines use tick, actually 🙂

---

<div class="post-metadata">

**Author:** ![Taracast](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Taracast](https://forums.unrealengine.com/u/Taracast)\
**Post date:** [June 2, 2022, 7:47am UTC](https://forums.unrealengine.com/t/wrong-rotation/571626/10 "2022-06-02T07:47:30Z")

</div>

Yeap )
