How would you calculate the total number of yaw degrees that an object has rotated/spun around, from a specified yaw?

I want the player to be able to click on an object and have it spin around rapidly & randomly around it’s yaw, it could spin 1080 degrees one time or 5000 degrees the next time you click it.

I want a value that will hold the amount of degrees it has rotated from it’s starting point, and I want the value to be updated and printed to the screen as soon as the object starts to spin.

• For example, the object could start at a yaw of 50 degrees & spin 45 times.

I am really having trouble with how I would store this value, because if I do:

“SpinValue = Abs(object.currentYaw - startingPointYaw)”

This doesn’t work because the yaw rotation starts again from 0 after passing 360 degrees

Please help, i am a complete noob to mathematics however I am really motivated to learn & would appreciate someone sending me in the right direction with how a mathematician would say:

“Calculate the total degrees that a wheel has turned after getting spun around”

If you’re the one applying the rotation, just keep a running total of what you’ve applied. So if you rotate by 5 degrees in a tick, then add 5 to the total.

Otherwise no, you can’t know how much an actor has rotated in the past. Actors (specifically the actor’s transform) only track their current orientation.

If I understand what you are asking:

// running total of degrees rotated

• float totalDegreesRotated = 1000;

// current rotation of object

• float currentYaw = startingYaw + (totalDegreesRotated % 360.0f);