# Eular Measurements and Rotations.

**URL:** <https://forums.unrealengine.com/t/eular-measurements-and-rotations/2188832>\
**Category:** Blueprint\
**Tags:** UE-5, unreal-engine, UE5, question, UE503\
**Created:** [December 9, 2024, 3:27pm UTC](https://forums.unrealengine.com/t/eular-measurements-and-rotations/2188832 "2024-12-09T15:27:00Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Skyboy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Skyboy](https://forums.unrealengine.com/u/Skyboy)\
**Post date:** [December 9, 2024, 3:27pm UTC](https://forums.unrealengine.com/t/eular-measurements-and-rotations/2188832/1 "2024-12-09T15:27:00Z")

</div>

Hey,

Ok so I’m starting to feel pretty silly. I’m stuck on this for a few hours, and it feels so easy, but I just can’t find the answer.

Eg. Tracking a cubes rotation. I want to continuously track how far the cube has rotated since starting the rotation.

The problem is using get world rotation or transform shows the degrees going from 0 to 90 and the back to 0 before going negative, Which makes sense. Assumably it’s split into 4 quadrants.

But How would I go about calculating total rotation since the beginning?

Thanks for reading 🙂

Update:  
I assume I need a variable “Total rotation”, Youd take the chosen axis (Im using pitch currently)

Cant use add, as itll add the total rotation and pitch together costantly just screaming up the numbers.

maybe delta(rotator) somehow.

---

<div class="post-metadata">

**Author:** ![VisAgilis](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/visagilis/32/891043_2.png) [@VisAgilis](https://forums.unrealengine.com/u/VisAgilis)\
**Post date:** [December 9, 2024, 4:07pm UTC](https://forums.unrealengine.com/t/eular-measurements-and-rotations/2188832/2 "2024-12-09T16:07:49Z")

</div>

Could you show your blueprint code? A rotation value actually ranges from -180 to 180.

---

<div class="post-metadata">

**Author:** ![Skyboy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Skyboy](https://forums.unrealengine.com/u/Skyboy)\
**Post date:** [December 9, 2024, 4:14pm UTC](https://forums.unrealengine.com/t/eular-measurements-and-rotations/2188832/3 "2024-12-09T16:14:35Z")

</div>

I apologize, I’ve just deleted it and having another rebuild now. Tbh there wasn’t a lot to show.

I have my cube, and I’m getting its rotation. Using “get world rotation” and exactly right, The returning string as I rotate the cube. is between -180 and 180.

It goes up to 90 degrees and returns to 0 before going negative -90 and back to 0.

But I want to calculate the total rotation its made.

---

<div class="post-metadata">

**Author:** ![VisAgilis](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/visagilis/32/891043_2.png) [@VisAgilis](https://forums.unrealengine.com/u/VisAgilis)\
**Post date:** [December 9, 2024, 4:36pm UTC](https://forums.unrealengine.com/t/eular-measurements-and-rotations/2188832/4 "2024-12-09T16:36:45Z")

</div>

The rotation in world space will give you the rotation in world space. That’s totally expected. If you want to get the difference in rotation, you can simply store the object’s rotation in world space inside a rotator type variable before rotating it, and once it’s rotated, compare the stored rotation value with the actor’s current world rotation by using the Delta Rotator node.

However if you’re smoothly rotating an object and comparing it’s current rotation with a pre-determined starting rotation, to continue getting positive values _(181 instead of -179 for example)_ you can update the stored rotation and after every comparison with the current rotation, you can add the result onto a float type variable _(or rotator if you want to get all of the axes)_

Hope this helps! 😇

---

<div class="post-metadata">

**Author:** ![Skyboy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Skyboy](https://forums.unrealengine.com/u/Skyboy)\
**Post date:** [December 9, 2024, 4:59pm UTC](https://forums.unrealengine.com/t/eular-measurements-and-rotations/2188832/5 "2024-12-09T16:59:46Z")

</div>

Yeah, ah right, OK. I understand the question I’m trying to ask better.

I have a smoothly rotating cube that’s input is decided by a mouse/touch. Using add local rotation.

And Im trying to calculate total degrees rotated as it smoothly spins. This could be both forwards and backwards.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/3/f/13f85b6232d712ea24a4a5dc14a71e8db5d3f844.png)

This is kind of a simplified version of what is going on.

So Im figuring out the order between event tick and add local to calculate total degrees rotated.

---

<div class="post-metadata">

**Author:** ![VisAgilis](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/visagilis/32/891043_2.png) [@VisAgilis](https://forums.unrealengine.com/u/VisAgilis)\
**Post date:** [December 9, 2024, 5:08pm UTC](https://forums.unrealengine.com/t/eular-measurements-and-rotations/2188832/6 "2024-12-09T17:08:32Z")

</div>

What’s Event Tick doing there 🤔

Anyways, I see you’re controlling the rotation with player input. That wasn’t what I meant by smoothly rotating it, this would actually be categorized better with the snappy usage.

Now, you didn’t clarify your objective in your last post but considering the previous ones, I think you wanna get the rotation value in world space in (0, 360) range instead of (-180, 180). If so, you can just get the actor’s rotation as normal, but use a Branch node to check if it’s negative or not and if it is, add 360 onto the result before storing it inside a variable.

---

<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:** [December 9, 2024, 5:14pm UTC](https://forums.unrealengine.com/t/eular-measurements-and-rotations/2188832/7 "2024-12-09T17:14:37Z")

</div>

> [@Skyboy](#):
>
> And Im trying to calculate total degrees rotated as it smoothly spins. This could be both forwards and backwards.

Have a variable track it and set component rotation to that value:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/3/4/9343a64578b59da8bc42daa304dc065eba337070.png)

* * *

In your very case: instead of +1 as above, add what the input node axis spit out. You can then use `modulo` to calc how many quadrant (or whatever) that is.

---

<div class="post-metadata">

**Author:** ![Skyboy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Skyboy](https://forums.unrealengine.com/u/Skyboy)\
**Post date:** [December 9, 2024, 5:22pm UTC](https://forums.unrealengine.com/t/eular-measurements-and-rotations/2188832/8 "2024-12-09T17:22:32Z")

</div>

I feel I should rephrase everything as I feel Im being confusing.

I have a mouse input that rotates a cube, you can flick the mouse and watch the cube to spin.

I initially used simulate physics for this, which worked well. But When you release the mouse(and 0 was no longer the angular velocity), it throws itself eventually off axis, which was a pain for accuracy.

I cant lock the axis as I need to influence axis with certain types of rotation.

So instead I swapped to this adjusting the rotation with the mouse and the event tick keeps the cube spinning depending on the mouse inputs.

But now I need to calculate how far the cube has spun so I need to swap the 0 to 90 degrees and back to 0 and then inverted -90 and back to 0 (Not sure what this rotation style is called)

for 0-360. So I can calculate when the cube has done a full spin.

> [@VisAgilis](#):
>
> I think you wanna get the rotation value in world space in (0, 360) range instead of (-180, 180)

This.

Or if anyone knows how to stop simulated physics throwing itself off axis as well lol?

---

<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:** [December 9, 2024, 5:29pm UTC](https://forums.unrealengine.com/t/eular-measurements-and-rotations/2188832/9 "2024-12-09T17:29:27Z")

</div>

> [@Skyboy](#):
>
> Or if anyone knows how to stop simulated physics throwing itself off axis as well lol?

- constrain it
- ensure the centre is centred in the modelling mode
- for complex meshes, with many convex shapes you may need to disable colliders’ mass contribution

---

<div class="post-metadata">

**Author:** ![VisAgilis](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/visagilis/32/891043_2.png) [@VisAgilis](https://forums.unrealengine.com/u/VisAgilis)\
**Post date:** [December 9, 2024, 5:29pm UTC](https://forums.unrealengine.com/t/eular-measurements-and-rotations/2188832/10 "2024-12-09T17:29:38Z")

</div>

> [@Skyboy](#):
>
> how to stop simulated physics throwing itself off axis

I didn’t quite get what you meant by that but since you confirmed that your objective was what I was guessing, this should do the job:

> [@VisAgilis](#):
>
> you can just get the actor’s rotation as normal, but use a Branch node to check if it’s negative or not and if it is, add 360 onto the result before storing it inside a variable

* * *

And also

> [@Everynone](#):
>
> You can then use `modulo` to calc how many quadrant (or whatever) that is

Haven’t tried such a thing but sounds interesting! 😁

---

<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:** [December 9, 2024, 5:31pm UTC](https://forums.unrealengine.com/t/eular-measurements-and-rotations/2188832/11 "2024-12-09T17:31:56Z")

</div>

> [@VisAgilis](#):
>
> sounds interesting

Or even simpler:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/1/3/a13acc9af7213942a7fb504f95c33a970ea6b6f2.png)

---

<div class="post-metadata">

**Author:** ![Skyboy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Skyboy](https://forums.unrealengine.com/u/Skyboy)\
**Post date:** [December 9, 2024, 6:23pm UTC](https://forums.unrealengine.com/t/eular-measurements-and-rotations/2188832/12 "2024-12-09T18:23:34Z")

</div>

xD As I feared, I do not understand any of this, lol.

I found the name, someone might have mentioned it already. “Eular angles”. After looking into it, I ended up I think somewhere close to what was being discussed here.

Although it kinda works. It hits about 70 degrees and bounces back again instead of just continuing up to 360 or down.

 ![Unreal](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/0/3/8036a3eabe8a4364ace5d67539a124c9b98b97da.jpeg)

I think its just the order of the nodes need mixing up.

---

<div class="post-metadata">

**Author:** ![VisAgilis](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/visagilis/32/891043_2.png) [@VisAgilis](https://forums.unrealengine.com/u/VisAgilis)\
**Post date:** [December 9, 2024, 6:35pm UTC](https://forums.unrealengine.com/t/eular-measurements-and-rotations/2188832/13 "2024-12-09T18:35:22Z")

</div>

> [@Skyboy](#):
>
> I think its just the order of the nodes need mixing up.

Let’s start from the scratch 😅

It’s just this:

If the float value _(pitch, in your case)_ is less than 0, add 360 onto it.

To do that, you can get an addition (+) node, plug the pitch value into one of it’s pins, then insert the value “360” into the other pin by typing into it, and set your float type variable to it. If the pitch value was already greater or equal to 0, then just directly set your float type variable to it.

---

<div class="post-metadata">

**Author:** ![Skyboy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Skyboy](https://forums.unrealengine.com/u/Skyboy)\
**Post date:** [December 9, 2024, 7:04pm UTC](https://forums.unrealengine.com/t/eular-measurements-and-rotations/2188832/14 "2024-12-09T19:04:48Z")

</div>

I burst out laughing, xD I think I’m actually going slowly insane. This?

 ![Unreal](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/2/d/82d680d789cf2c9c935f1924933b973ee70d9a66.jpeg)

It feels closer xD.  
It goes between 282 up to 360 which flips then flips to 0 and goes to 82. And then inverts and goes back down to 0 before flipping and going back to 282.

Basically bouncing between 282 and 82.

---

<div class="post-metadata">

**Author:** ![VisAgilis](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/visagilis/32/891043_2.png) [@VisAgilis](https://forums.unrealengine.com/u/VisAgilis)\
**Post date:** [December 9, 2024, 7:13pm UTC](https://forums.unrealengine.com/t/eular-measurements-and-rotations/2188832/15 "2024-12-09T19:13:57Z")

</div>

> [@Skyboy](#):
>
> It goes between 282 up to 360

While doing what? Rotating about 90 degrees and getting the world / relative rotation? That would be expected. Because the initial rotation of the cube matters in this case. If you want to get the difference in rotation, you’d wanna subtract the initial rotation from the result.

---

<div class="post-metadata">

**Author:** ![Skyboy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Skyboy](https://forums.unrealengine.com/u/Skyboy)\
**Post date:** [December 9, 2024, 7:53pm UTC](https://forums.unrealengine.com/t/eular-measurements-and-rotations/2188832/16 "2024-12-09T19:53:50Z")

</div>

I wish I could figure out gifs so I could just send a gif xD.

It’s the Euler system that’s used that’s just absolutely baffling. Trying to convert the Euler system into just a normal 0-360 scale so I can use it to calculate rotation amount.

Obj. I just want to spin a cube with my mouse and when it does a full 360 degree spin, have it say backflip xD.  
And then later maybe insert some specific angles for different spins. and it has to be dynamic to the rotation happening so I cant set it, or preset it. The player might wildly just spin the cube and it needs to calculate how many degrees its spun.

Itd be nice to be able to show the player exactly how many degrees they’ve done before the backflip is hit (360) done.

In my head, it’s so basic. But It’s quite the brickwall.

Hopefully the objective makes sense a bit better, Im going to go apply a straight jacket after battling this today xD.

---

<div class="post-metadata">

**Author:** ![VisAgilis](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/visagilis/32/891043_2.png) [@VisAgilis](https://forums.unrealengine.com/u/VisAgilis)\
**Post date:** [December 9, 2024, 9:15pm UTC](https://forums.unrealengine.com/t/eular-measurements-and-rotations/2188832/17 "2024-12-09T21:15:47Z")

</div>

In that case, you can do it like this:

 ![Image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/8/d/18d78e6f2702383af0e308b55fea192f03b9c430.png)

Here’s the result:

Hope this helps! 😇

---

<div class="post-metadata">

**Author:** ![Skyboy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Skyboy](https://forums.unrealengine.com/u/Skyboy)\
**Post date:** [December 10, 2024, 1:31pm UTC](https://forums.unrealengine.com/t/eular-measurements-and-rotations/2188832/18 "2024-12-10T13:31:22Z")

</div>

Thanks for all the help, So I stayed up late banging my head against it. That example I got working with the camera, But I couldn’t replicate the results with pawns.

So I went back to simulate physics as I think It worked better compared to just adding local rotation. I then managed to get it to track with this.

 ![Unreal](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/2/8/a28b7928fae4186e8da3e08926e5fc7ddec3b604.jpeg)

So now I can make adjustments to the power and speed of the adjustments, I can record total degrees used up and down.

BUT I’m a bit back to square one, where my lil guy (Cube man) Spins wildly off axis after a second or 2. So hes either no very well balanced or hes being influenced by something.

I can’t lock the axis as I need to influence them later.

---

<div class="post-metadata">

**Author:** ![VisAgilis](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/visagilis/32/891043_2.png) [@VisAgilis](https://forums.unrealengine.com/u/VisAgilis)\
**Post date:** [December 10, 2024, 2:34pm UTC](https://forums.unrealengine.com/t/eular-measurements-and-rotations/2188832/19 "2024-12-10T14:34:18Z")

</div>

## **Jump to the very bottom for the implementation of your objective**

> [@Skyboy](#):
>
> I couldn’t replicate the results with pawns

Absolutely nothing is different in the logic. Here:

Can you show your attempt on implementing the code I provided, along with the outcome?

* * *

> [@Skyboy](#):
>
> adding local rotation

Why don’t you just add controller yaw & pitch inputs and enable the spring arm to use pawn control rotation like this? 🤔 _(Wait I get what you’re trying to do, I’ll edit once again)_

 ![Screenshot 2024-12-10 173758](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/1/b/51b346782daf370e08f0fd179e14f0a103ad9664.png)

![Screenshot 2024-12-10 174036](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/4/5/44542181b7398b6e889ab2d395ce82ef1645f994.png)

* * *

So if you wanna only rotate the mesh and not the camera like this:

 ![Screenshot 2024-12-10 180439](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/3/6/336d0a6f85d1605695f5a9bb9b80e7bac8b70516.png)

The logic would still be the same! You can just play with the threshold value we’ve set up according to the input intensity we got above. Here’s the revised logic with the correct threshold value for my specific multiplier:

 ![Screenshot 2024-12-10 180908](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/a/c/5ace05d0dcdd57728f037db60b005f7073ef08a4.png)

And here’s the result:

---

<div class="post-metadata">

**Author:** ![Skyboy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Skyboy](https://forums.unrealengine.com/u/Skyboy)\
**Post date:** [December 11, 2024, 3:48pm UTC](https://forums.unrealengine.com/t/eular-measurements-and-rotations/2188832/20 "2024-12-11T15:48:26Z")

</div>

Sorry, I only just back to this.

I’ve been playing a lot, I apologize for having nothing to show, But Ive been flip-flopping between all sorts to kind of get to grasps with understanding Euler angles and how it relates accurately to degrees rotated.

Baffling system, Eg. a 360 on the Y axis performs a flip. Perfect. If you slightly go off axis, a true full 360 isn’t performed, as you’re no longer doing a perfect Yaxis flip.

So how I imagine for example a cork 540 to be done, 360 on one axis and 180 on another isn’t going to accurately show that in degrees when trying to measure exact degrees.

Here’s where I’m at atm, I’ve tried to replicate yours to align our viewpoints to bring confusion down. (I have a habit of being incredibly confusing at the best of times)

 ![Unreal](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/8/5/f857166842fa6f37b06f1c6913f1789637cef7ee.jpeg)

Ive connected the event tick just so It doesnt lose itself when the mouse is unclicked.

A few Questions.  
So how come x3?  
Is the action value X from the enhanced input action 0.33 of a degree?

What is the clamp for?

[Next page](https://forums.unrealengine.com/t/eular-measurements-and-rotations/2188832.md?page=2)
