# Rotating component on Z axis?

**URL:** <https://forums.unrealengine.com/t/rotating-component-on-z-axis/1644446>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, question\
**Created:** [January 26, 2024, 6:48pm UTC](https://forums.unrealengine.com/t/rotating-component-on-z-axis/1644446 "2024-01-26T18:48:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![baobao4435](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/baobao4435/32/950790_2.png) [@baobao4435](https://forums.unrealengine.com/u/baobao4435)\
**Post date:** [January 26, 2024, 6:48pm UTC](https://forums.unrealengine.com/t/rotating-component-on-z-axis/1644446/1 "2024-01-26T18:48:33Z")

</div>

Hello,sir.please help me.  
I want to rotate a component on Z axis.  
I tried a lot of nodes like “set relative rotation”, “set world rotation”. it’ll go well until the object is tilted.  
Rotating on Z axis doesn’t work on tilted object?  
And then I found a node called “add local rotation”.  
It kinda work,but still strange.

  
The video above shown it’s rotating correctly(the top middle small box,the flying box is he’s child component),but you can see the rotation is not smooth.

And here’s it’s simple BP, the number 38 is a random number I tried. Other number it won’t rotate a whole circle.why’s that?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/3/e/c3e8715927daf384e3815d39c2fdc6580c62eb62.jpeg)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/d/7/6d727b3f5b0c9dad1a00f50e19fd8065220a3d01.jpeg)

---

<div class="post-metadata">

**Author:** ![ShawnDaGeek](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shawndageek/32/734104_2.png) [@ShawnDaGeek](https://forums.unrealengine.com/u/ShawnDaGeek)\
**Post date:** [January 26, 2024, 7:22pm UTC](https://forums.unrealengine.com/t/rotating-component-on-z-axis/1644446/2 "2024-01-26T19:22:57Z")

</div>

I had a similar issue with a binary star setup, this is how i did. I was able to do a pitch, while still incrementing yaw.

1. Get Trasnform / Break

2. Increment axis by desired, send to lerp, make new rotation.

3. Make new transform, set actor transform “relative if needed”.

 ![BinaryStarSystem_Zaxis](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/9/e/e9eb306f749632e9141db330211207d179b2a2a6.png)

---

<div class="post-metadata">

**Author:** ![baobao4435](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/baobao4435/32/950790_2.png) [@baobao4435](https://forums.unrealengine.com/u/baobao4435)\
**Post date:** [January 26, 2024, 8:36pm UTC](https://forums.unrealengine.com/t/rotating-component-on-z-axis/1644446/3 "2024-01-26T20:36:24Z")

</div>

Thank you for take your time to help me.  
I will try your solution.  
And I researched some other topics.  
And they described very well.  
I think it’s my lack of base knowledge causing the issue.

> [@Set local rotation](https://forums.unrealengine.com/t/set-local-rotation/391658/2):
>
> 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.

> [@what is the difference between "Add Relative Rotation" and "Add Local Rotation"](https://forums.unrealengine.com/t/what-is-the-difference-between-add-relative-rotation-and-add-local-rotation/1244791/6):
>
> Have this BP with a cylinder component, which has relative rotation X = 20 So the cylinder is rotated 20 degrees around X (red) axis from the parent reference frame. [image] The reference frame (gizmo) shown above is the relative (parent’s) reference frame. If I add a relative Z rotation to cylinder, it’s gonna rotate around that blue axis : [aaaaaa] Now this is the cylinder’s local reference frame : [image] If I add the same Z rotation as a local rotation, it’s gonna rotate a…

---

<div class="post-metadata">

**Author:** ![Roy\_Wierer.Seda145](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roy_wierer.seda145/32/906551_2.png) [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Post date:** [January 26, 2024, 10:41pm UTC](https://forums.unrealengine.com/t/rotating-component-on-z-axis/1644446/4 "2024-01-26T22:41:52Z")

</div>

Absolute rotation is not relative to anything, meaning setting anything to an absolute rotation of 90 makes every object or component you set to that point to the same direction.

Relative rotation is when you rotate one thing relative to something else. This is what happens to your fingers when you move and rotate your wrist, your fingers will also move and rotate relative to your wrist.

Last thing to understand is that you can rotate around a point, but that point can technically be anywhere. This is the pivot point.

Just like earth can rotate around its own axis but also rotate relatively to a point in orbit. In games a highly simplified “orbit behavior” could be a sphere rotating around a point which is not its own center but another location. The pivot point.

You could see “absolute” as the base rotation / position / scale of the entire universe, “relative” as an offset to something else (usually in a parent structure, a hand is offset by an arm), and “local” an offset to the self.

---

<div class="post-metadata">

**Author:** ![baobao4435](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/baobao4435/32/950790_2.png) [@baobao4435](https://forums.unrealengine.com/u/baobao4435)\
**Post date:** [January 27, 2024, 12:36pm UTC](https://forums.unrealengine.com/t/rotating-component-on-z-axis/1644446/5 "2024-01-27T12:36:46Z")

</div>

Thanks for responding,I learned a lot from your answer.  
Handle rotation is more complicated then I think…

---

<div class="post-metadata">

**Author:** ![baobao4435](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/baobao4435/32/950790_2.png) [@baobao4435](https://forums.unrealengine.com/u/baobao4435)\
**Post date:** [January 27, 2024, 12:38pm UTC](https://forums.unrealengine.com/t/rotating-component-on-z-axis/1644446/6 "2024-01-27T12:38:36Z")

</div>

And here’s I fixed the BP

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/f/2/1f2c1d4876f7dd834b031eafca77407771fb706e.jpeg)

---

<div class="post-metadata">

**Author:** ![Roy\_Wierer.Seda145](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roy_wierer.seda145/32/906551_2.png) [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Post date:** [January 27, 2024, 9:02pm UTC](https://forums.unrealengine.com/t/rotating-component-on-z-axis/1644446/7 "2024-01-27T21:02:10Z")

</div>

Some youtube channels can teach a lot:

> [https://www.youtube.com/@MathewWadsteinTutorials/videos](https://www.youtube.com/@MathewWadsteinTutorials/videos)

> [https://www.youtube.com/@Acegikmo/videos](https://www.youtube.com/@Acegikmo/videos)

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [February 26, 2024, 9:03pm UTC](https://forums.unrealengine.com/t/rotating-component-on-z-axis/1644446/8 "2024-02-26T21:03:09Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
