# Getting actor's relative rotation

**URL:** <https://forums.unrealengine.com/t/getting-actors-relative-rotation/416488>\
**Category:** Community & Industry Discussion\
**Tags:** relative, actor, rotation, get, unreal-engine, question\
**Created:** [February 5, 2018, 5:52pm UTC](https://forums.unrealengine.com/t/getting-actors-relative-rotation/416488 "2018-02-05T17:52:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SONB](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SONB](https://forums.unrealengine.com/u/SONB)\
**Post date:** [February 5, 2018, 5:52pm UTC](https://forums.unrealengine.com/t/getting-actors-relative-rotation/416488/1 "2018-02-05T17:52:28Z")

</div>

Hi,  
I’m having some difficulties/inconsistencies getting the relative rotation of an actor, which is attached to another actor.

Following setup:

- Parent actor (named “Module”) with a socket
- Child actor (named “Dock”; it’s not a Child Actor Component!)

On BeginPlay the **Module** actor spawns and attaches a **Dock** actor to a socket inside the **Module**.

At some point in time the **Dock** actor needs to know its rotation relative to its parent actor, the **Module**. It’s doing it like this:

![229570-actor-relative-rotation.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/0/0/0003c9d807c2b2c9031ef923ef19ed8f016359cf.png)

In my understanding the acquired relative rotation of the **Dock** shouldn’t be changing when I rotate its parent **Module** in the world. And it works perfectly fine as long as I don’t touch the Y rotation value of the socket the **Dock** is attached to. If Y is not equal 0 and I rotate the **Module** while playing, the relative rotation of the **Dock** it’s printing on the screen is constantly changing. If Y is equal 0, the relative rotation stays the same, no matter what I do with the **Module** , which is the expected result. Changing X and Z values of the socket’s rotation has no issues.

Is it just a bug or am I doing it completely wrong? Is there an other way to get the rotation of an actor relative to another actor?

---

<div class="post-metadata">

**Author:** ![SONB](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SONB](https://forums.unrealengine.com/u/SONB)\
**Post date:** [February 15, 2018, 9:45pm UTC](https://forums.unrealengine.com/t/getting-actors-relative-rotation/416488/2 "2018-02-15T21:45:33Z")

</div>

I found out that the unexpected behavior of the inverse transform is caused by the gimbal lock. I solved this issue in C++ using only quaternions.

---

<div class="post-metadata">

**Author:** ![Drkephrim](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Drkephrim](https://forums.unrealengine.com/u/Drkephrim)\
**Post date:** [February 20, 2019, 4:21pm UTC](https://forums.unrealengine.com/t/getting-actors-relative-rotation/416488/3 "2019-02-20T16:21:01Z")

</div>

Hi there, could you go over specifically what methods to use to solve the issue? I’m having some rotation related problems as well, and I think your solution may help.
