- Home /
Always rotating an object to a set angle?
Hi there, I'm currently trying to figure out how to make an object always rotate to a specific angle on a single axis (the x axis, in my case).
I can do something simple with a couple of if statements, telling it to rotate in a direction if the angle is above or below what I want, but the best I can manage is having it work from one direction (x being lower than 90, the angle I want), but if it's greater than this, it rotates in the wrong direction until it eventually reaches the correct number.
I considered rotate.LookAt, but I want it to be able to rotate on the x axis, just that when it's not at a set angle I'd like it to slowly rotate back to the position I want.
I am exceedingly tired, so I apolagize for the awful sentence structure here. I'd be very grateful for any help offered.
Have you looked at $$anonymous$$athf.LerpAngle()? That will let you lerp an angle towards another one over time...