# How to stop 'Add Relative Rotation' to a certain value?

**URL:** <https://forums.unrealengine.com/t/how-to-stop-add-relative-rotation-to-a-certain-value/1855436>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, question\
**Created:** [May 14, 2024, 10:44am UTC](https://forums.unrealengine.com/t/how-to-stop-add-relative-rotation-to-a-certain-value/1855436 "2024-05-14T10:44:15Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![WDRK23](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/wdrk23/32/1002509_2.png) [@WDRK23](https://forums.unrealengine.com/u/WDRK23)\
**Post date:** [May 14, 2024, 10:44am UTC](https://forums.unrealengine.com/t/how-to-stop-add-relative-rotation-to-a-certain-value/1855436/1 "2024-05-14T10:44:15Z")

</div>

Hi! I want to rotate the object by a few stops, like 180 or 360 on the z-axis, but when I tried to get the current value, it gives an unexpected value, from 0 to -180 and then from 180 to 0.  
Is there any way to realize these stops?  
I don;t want to use timeline with **SetRelativeRotation** for this.

 ![ccc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/5/8/2580c18247d91c050879ecf4417de830101c84c6.png)

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/1/6/b16c67b3bc9e90a8b00aedd579b4092f52f56168.jpeg "2024 05 14 13 33 05") ](https://www.youtube.com/watch?v=JWyVx48Tk6Y)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 14, 2024, 11:05am UTC](https://forums.unrealengine.com/t/how-to-stop-add-relative-rotation-to-a-certain-value/1855436/2 "2024-05-14T11:05:16Z")

</div>

Perhaps `Add Relative Rotation` is the wrong tool here. Do tell what the ideal end result it.

> [@WDRK23](#):
>
> I don;t want to use timeline with **SetRelativeRotation** for this.

You could drive it with a motor:

> [@Forcing physics cube to rotate and stop every 90 degress](https://forums.unrealengine.com/t/forcing-physics-cube-to-rotate-and-stop-every-90-degress/1759797/3):
>
> Angular Dampening on the mesh is set to 0.1. You will also need to punch in p.Chaos.Solver.SleepEnabled 0 into the console since Chaos likes to snooooze. Or switch to the Physics Control plugin which grants more control.

* * *

Or this:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/d/6/bd60c3282b3c2c78345dc7ea834ce98544610357.png)

Would produce this, snapping it to the desired angle:

* * *

Or replace the node with:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/b/9/ab90d5153dade180594d3c7c019546abf69db8cc.png)

Really depends on the desired end result.

> How to stop ‘Add Relative Rotation’ to a certain value?

Not entirely sure what this means.

---

<div class="post-metadata">

**Author:** ![WDRK23](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/wdrk23/32/1002509_2.png) [@WDRK23](https://forums.unrealengine.com/u/WDRK23)\
**Post date:** [May 14, 2024, 11:29am UTC](https://forums.unrealengine.com/t/how-to-stop-add-relative-rotation-to-a-certain-value/1855436/3 "2024-05-14T11:29:20Z")

</div>

it works with **SetActorRotation** , but if I put 180 instead of 90, after the first 180 rotation it will return as -180. I want something like 180 first and 360 second.

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/6/d/86d013b7e322130d94055187ad4f12b5b28dc5f2.jpeg "z axis 180") ](https://www.youtube.com/watch?v=iSzhNWpHhIs)

It works the same with X axis, but for Y something is wrong.

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/5/1/1516852fd6c87d08de94dbf11f0ccb5ac7e7711b.jpeg "y axis 90") ](https://www.youtube.com/watch?v=_QxRVsKYpwU)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 14, 2024, 11:30am UTC](https://forums.unrealengine.com/t/how-to-stop-add-relative-rotation-to-a-certain-value/1855436/4 "2024-05-14T11:30:11Z")

</div>

Try the last node I suggested - see how it goes.

---

<div class="post-metadata">

**Author:** ![WDRK23](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/wdrk23/32/1002509_2.png) [@WDRK23](https://forums.unrealengine.com/u/WDRK23)\
**Post date:** [May 14, 2024, 11:32am UTC](https://forums.unrealengine.com/t/how-to-stop-add-relative-rotation-to-a-certain-value/1855436/5 "2024-05-14T11:32:54Z")

</div>

With AddLocalRotation works the same.

 ![C2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/5/b/35b20a97427a98d0bc0d2cd000c119087fdde6ac.png)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 14, 2024, 11:36am UTC](https://forums.unrealengine.com/t/how-to-stop-add-relative-rotation-to-a-certain-value/1855436/6 "2024-05-14T11:36:43Z")

</div>

No, no. Use what you wanted here:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/4/6/346e83ee2fb5b028dd643c38962598ea2f5a0050.png)

Just replace that **one** node.

* * *

Admittedly, you actually never explained how it **should** work. We can only see that something is wrong. What are we trying to achieve? Press a button and rotate by X degrees? Or hold a button to rotate a bit every frame? Because that’s what your script has and it’s the only thing to go by.

And your last screenshot uses world rotation for a component that is most likely operating in local space. We do not know the hierarchy either.

Sorry, too many unknowns here.

* * *

> I want to rotate the object by a few stops, like 180 or 360 on the z-axis

It’s this then:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/d/6/bd60c3282b3c2c78345dc7ea834ce98544610357.png)

Or is **specifically** 180 - we want to **flip** it about?

---

<div class="post-metadata">

**Author:** ![WDRK23](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/wdrk23/32/1002509_2.png) [@WDRK23](https://forums.unrealengine.com/u/WDRK23)\
**Post date:** [May 14, 2024, 11:44am UTC](https://forums.unrealengine.com/t/how-to-stop-add-relative-rotation-to-a-certain-value/1855436/7 "2024-05-14T11:44:35Z")

</div>

I’m sorry for the misunderstanding, i don’t know exactly how to write either.  
I want to press once for a 180 spin and another one for 360.  
It’s like your exemple with SetActorRotation, but with 180, not 90 degrees.  
I need to rotate the object inside the actor, not rotate the actor itself.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 14, 2024, 11:52am UTC](https://forums.unrealengine.com/t/how-to-stop-add-relative-rotation-to-a-certain-value/1855436/8 "2024-05-14T11:52:43Z")

</div>

I set it up again but it seems to work fine:

Rotating just the comp relative to th actor:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/b/d/bbde154080a8b8cfac9a95028e527d981c57fbd8.png)

Is the anim close enough to what’s needed?

---

<div class="post-metadata">

**Author:** ![WDRK23](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/wdrk23/32/1002509_2.png) [@WDRK23](https://forums.unrealengine.com/u/WDRK23)\
**Post date:** [May 14, 2024, 11:57am UTC](https://forums.unrealengine.com/t/how-to-stop-add-relative-rotation-to-a-certain-value/1855436/9 "2024-05-14T11:57:42Z")

</div>

This is the problem. Instead of going 360 degrees, it will go backwards.  
That’s why I wanted to use **Add Local Rotation/ Add Relative Rotation** because it rotates completely 360, but I don’t know how to stop when it reaches the threshold of 360 or if you want 180 as well.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 14, 2024, 11:58am UTC](https://forums.unrealengine.com/t/how-to-stop-add-relative-rotation-to-a-certain-value/1855436/10 "2024-05-14T11:58:14Z")

</div>

So it’s about the **direction** it goes back?

---

<div class="post-metadata">

**Author:** ![WDRK23](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/wdrk23/32/1002509_2.png) [@WDRK23](https://forums.unrealengine.com/u/WDRK23)\
**Post date:** [May 14, 2024, 11:59am UTC](https://forums.unrealengine.com/t/how-to-stop-add-relative-rotation-to-a-certain-value/1855436/11 "2024-05-14T11:59:25Z")

</div>

Yes!

[![]( " - YouTube") ](https://www.youtube.com/watch?v=8497Y-ySAnw)
