# Set local rotation

**URL:** <https://forums.unrealengine.com/t/set-local-rotation/391658>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [April 23, 2017, 1:07am UTC](https://forums.unrealengine.com/t/set-local-rotation/391658 "2017-04-23T01:07:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gumballcrash](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gumballcrash](https://forums.unrealengine.com/u/Gumballcrash)\
**Post date:** [April 23, 2017, 1:07am UTC](https://forums.unrealengine.com/t/set-local-rotation/391658/1 "2017-04-23T01:07:32Z")

</div>

Unfortunately it seems there is no “SetLocalRotation” node, and the only way to rotate an object on it’s local axis is to use the “AddLocalRotation” node.

I want an object to match the Z value rotation of another object, but to rotate on it’s local axis instead. Niether SetRelativeRotation or SetWorldRotation seem to work this way. Does anyone know of a way to set a local rotation instead of just adding to it?

---

<div class="post-metadata">

**Author:** ![ScottSpadea](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/scottspadea/32/1194682_2.png) [@ScottSpadea](https://forums.unrealengine.com/u/ScottSpadea)\
**Post date:** [April 23, 2017, 11:00am UTC](https://forums.unrealengine.com/t/set-local-rotation/391658/2 "2017-04-23T11:00:04Z")

</div>

local space rotations are for components that are attached to other components. if you want to rotate an actor around its up vector, you can use RotatorFromAxisAndAngle. and if you want to set the rotation, instead of adding to it, just skip the getActorRotation/CombineRotators part.

 ![135228-rotatorfromaxisandangle.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/9/a/e9a685b4a6c93b618ccafa7864fd4dbcd1737e4a.png)

---

<div class="post-metadata">

**Author:** ![Gumballcrash](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gumballcrash](https://forums.unrealengine.com/u/Gumballcrash)\
**Post date:** [April 23, 2017, 1:14pm UTC](https://forums.unrealengine.com/t/set-local-rotation/391658/3 "2017-04-23T13:14:29Z")

</div>

Thanks for your response!  
I should have included that the object I want to set rotation on is a component attached to another component.

I attempted it on the component using SetRelativeRotation in place of SetActorRotation and GetUpVector instead of GetActorUpVector. It does follow the rotation of whatever I feed it, but it still doesn’t want to rotate on it’s local axis.

---

<div class="post-metadata">

**Author:** ![ScottSpadea](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/scottspadea/32/1194682_2.png) [@ScottSpadea](https://forums.unrealengine.com/u/ScottSpadea)\
**Post date:** [April 23, 2017, 1:44pm UTC](https://forums.unrealengine.com/t/set-local-rotation/391658/4 "2017-04-23T13:44:39Z")

</div>

up vector is always a world vector, its not relative, so you should use SetWorldRotation instead of SetRelativeRotation.

 ![135243-rotatorfromaxisandangle2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/4/0/640dc44f0e903060b55fc42e4876a9a6de3cc1d2.png)

---

<div class="post-metadata">

**Author:** ![ScottSpadea](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/scottspadea/32/1194682_2.png) [@ScottSpadea](https://forums.unrealengine.com/u/ScottSpadea)\
**Post date:** [April 23, 2017, 2:22pm UTC](https://forums.unrealengine.com/t/set-local-rotation/391658/5 "2017-04-23T14:22:48Z")

</div>

and if you just want to set the rotation, instead of adding to it, replace the GetWorldRotation node with a Rotator variable, where you can store the default rotation.

---

<div class="post-metadata">

**Author:** ![Gumballcrash](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gumballcrash](https://forums.unrealengine.com/u/Gumballcrash)\
**Post date:** [April 23, 2017, 3:34pm UTC](https://forums.unrealengine.com/t/set-local-rotation/391658/6 "2017-04-23T15:34:40Z")

</div>

That worked!! Thank you so much! You saved me a lot of trial and error. 🙂
