You can just add 360 to the rotation value whenever it’s less than 0.
Best,
Jonathan Lambert
You can just add 360 to the rotation value whenever it’s less than 0.
Best,
Jonathan Lambert
Hi guys I have a question. I am rotating an object and I try to get the angle of the rotation. So its starts with 0 and when I want to make 360 the rotator goes to 90 then goes to 0 and from 0 it goes to -90 and from -90 it goes to 0 again. Can I make it return an angle from 0 to 360 instead of being limited to 90 or -90?
Thanks for your reply Jonathan. But the values in for instance 3rd and 4th quarter of the circle are the same. I’ve actually just solved the issue and was going to post an answer. Thank you for your time.
I’ve actually solved it the easiest way I could possibly think of. I just created auxillary float variable which I incremented and decremented by the same value that I was adding to the object’s rotator to rotate it. Then I clamped this value to fit between 0 and 360 degrees.
I would love to see the math behind this trick. I’m running into a similar issue. The math might help me. Thanx.
Hello. There is two integrated functions for this. Just type “rot” into search:
Clamp Axis function does exactly what you asking for - converts -180;180 angle to 0;360
Second function - normalize axis can convert angle back to -180;180.
“I’ve actually solved it the easiest way I could possibly think of. I just created auxillary float variable which I incremented and decremented by the same value that I was adding to the object’s rotator to rotate it. Then I clamped this value to fit between 0 and 360 degrees.”
How exactly did you do that?