# Component Local Rotation

**URL:** <https://forums.unrealengine.com/t/component-local-rotation/384609>\
**Category:** Community & Industry Discussion\
**Tags:** relative, rotation, child, unreal-engine, local, component, question\
**Created:** [February 11, 2017, 7:17am UTC](https://forums.unrealengine.com/t/component-local-rotation/384609 "2017-02-11T07:17:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![CrazyCatDev](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CrazyCatDev](https://forums.unrealengine.com/u/CrazyCatDev)\
**Post date:** [February 11, 2017, 7:17am UTC](https://forums.unrealengine.com/t/component-local-rotation/384609/1 "2017-02-11T07:17:41Z")

</div>

Greetings!

I have a static mesh as a child inside an actor. Both actors will rotate to face towards the direction of a spring arm that is also part of the actor. For reference, here is a screenshot showing my hierarchy.

 ![125846-shipdetails.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/b/9/7b9b89064ca563538c0f7a1bfd91e4d414d9dd13.jpeg)

The rotation works fine when the actor is level in world rotation (so no Roll or Pitch, only Yaw values). This can be seen in the following screenshot.

 ![125847-lookleft.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/e/8/7e88168523263455d4425e222ce8c8da1958e63f.jpeg)

If I look down or up (add values to the Pitch), the WeaponMount mesh will follow correctly, but if I THEN look left or right, the rotation starts to get weird.

 ![125848-lookdownleft.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/4/8/c48c341cdf5c8ad74ec993fe850f470e11f5f1fc.jpeg)

I want the WeaponMount to always be ‘attached’ to the SubMesh parent mesh, while being able to rotate on it’s local Yaw still, but this clearly ‘detaches’ it as the WeaponMount being to rotate in unwanted fashion.

Is there a tried and true method to achieving what I am after?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Iohoilpotere](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Iohoilpotere](https://forums.unrealengine.com/u/Iohoilpotere)\
**Post date:** [February 11, 2017, 7:57am UTC](https://forums.unrealengine.com/t/component-local-rotation/384609/2 "2017-02-11T07:57:51Z")

</div>

I should take a look at your blueprint but I assume you are making operations between rotators. You should try this function:

 ![125832-rotation.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/7/f/77f83cf4732a5fe7c72f7ed672b14e32b735e309.png)

---

<div class="post-metadata">

**Author:** ![MonsOlympus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/monsolympus/32/619062_2.png) [@MonsOlympus](https://forums.unrealengine.com/u/MonsOlympus)\
**Post date:** [February 11, 2017, 9:16am UTC](https://forums.unrealengine.com/t/component-local-rotation/384609/3 "2017-02-11T09:16:22Z")

</div>

You could try attaching it via a socket instead of letting it use its own transform. I have had a similar issue to this where the relative transform is out of whack to the parent transform, scaling on one axis would scale on the completely wrong one.

---

<div class="post-metadata">

**Author:** ![CrazyCatDev](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CrazyCatDev](https://forums.unrealengine.com/u/CrazyCatDev)\
**Post date:** [February 11, 2017, 12:09pm UTC](https://forums.unrealengine.com/t/component-local-rotation/384609/4 "2017-02-11T12:09:27Z")

</div>

After spending months of trying to figure it out then giving up, I managed to figure it out shortly after posting this haha.

 ![125856-relativerotation.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/b/7/6b77954aa9e8244da302715e7211824a9469052e.jpeg)

So I get the spring arm’s rotation relative to the SubMesh, and subtract the SubMesh World Yaw. That I plug in to the Yaw of a Set Relative Rotation for the WeaponMount.

Works like a charm now!

---

<div class="post-metadata">

**Author:** ![CrazyCatDev](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CrazyCatDev](https://forums.unrealengine.com/u/CrazyCatDev)\
**Post date:** [February 11, 2017, 12:11pm UTC](https://forums.unrealengine.com/t/component-local-rotation/384609/5 "2017-02-11T12:11:57Z")

</div>

I’d tried a socket in the past but had similar results with no improvement. As stated in my other comment though I have now figured it out!

---

<div class="post-metadata">

**Author:** ![Iohoilpotere](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Iohoilpotere](https://forums.unrealengine.com/u/Iohoilpotere)\
**Post date:** [February 11, 2017, 12:22pm UTC](https://forums.unrealengine.com/t/component-local-rotation/384609/6 "2017-02-11T12:22:15Z")

</div>

That look fine, just a little warning: don’t use too much operations between rotators, sometimes they messed up (because the reset or because interactions between Y,R,P), usually there’s always a function that do what you want to achieve! (answer yourself to your question and set it to solved, keep the answer hub in order 🙂 )

---

<div class="post-metadata">

**Author:** ![MonsOlympus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/monsolympus/32/619062_2.png) [@MonsOlympus](https://forums.unrealengine.com/u/MonsOlympus)\
**Post date:** [February 12, 2017, 5:37am UTC](https://forums.unrealengine.com/t/component-local-rotation/384609/7 "2017-02-12T05:37:39Z")

</div>

Yeah I think it has to do with the mesh orientation, its why Epic insists on them all being on the +X facing axis and Z-up. It tends to happen to me when I adjust the mesh offset before the translation takes place.
