quaternions, snapping, over time, and saving axes in variables. Where to begin?

Gentlemen,

I’ve been spending months trying to properly and accurately rotate a character, which is absolutely necessary for me (I’ve had people object already here).

I’ve been trying to rotate my character along the world axes and over time, but couldn’t use slerp because it would lock the player or keep trying to align the rotations indefinitely.
Using regular rotate with time.deltaTime causes an inaccuracy that I need to avoid.
It has to happen over time, as it’s disorienting enough as it is, and snapping would just be fatal.

I’ve currently been trying to use eulerangles to store and use data to snap when within certain thresholds, but, well, it’s honestly confusing the hell out of me. I was using rotate along the world axis so I wouldn’t have to keep track of the rotation data in the first place.

Does anyone know of an accurate way to rotate an object over time along only a single axis at a time?

I only need the characters feet to face north, south, west, east, up, or down (±(x,y,z)). I don’t need any more than that.

Any help or link to better information on rotation (haven’t been lucky so far) would be greatly appreciated. You have my thanks in advance.

I’m not 100% sure what your issue is but this is a snippet of code I recently wrote to snap the rotation of a game object along one axis. It might help you out.

zDelta += 5; // increment your angle
var angle = obj.transform.localEulerAngles.z + zDelta; // get new angle 
var snapAngle = Mathf.Round(angle / 45.0) * 45.0; // snap to the nearest 45 degrees
obj.transform.localEulerAngles.z = snapAngle;

you can use animations to rotate your character since you’re saying that Time.deltaTime didn’t quite do it for you, but that will be interpolated based on your frame-rate. It might help you to use Mathf.LerpAngle: Unity - Scripting API: Mathf.LerpAngle

Looks like your brains have stucked to infinite loop. I hate when that happens to me. Perhaps you can find some new thoughts with reading these:

http://docs.unity3d.com/Documentation/ScriptReference/Transform.RotateAround.html
http://answers.unity3d.com/questions/257862/player-movingrotating-along-a-single-axis.html
http://answers.unity3d.com/questions/137688/pretty-weird-issue-with-rotating-a-sphere.html#comment-263630

Custom search “rotate an object over time along a single axis” :
http://www.google.com/cse?cx=001712401338047450041%3Acsfhqk-trfa&ie=UTF-8&q=js&sa=Search&siteurl=www.google.com%2Fcse%2Fhome%3Fcx%3D001712401338047450041%3Acsfhqk-trfa&ref=&ss=37j1369j2#gsc.tab=0&gsc.q=rotate%20an%20object%20over%20time%20along%20a%20single%20axis

Thanks again! I’ll check into everything, but will test rapidfirestudio’s code first. I think everything will be fine if the snapping works.

As of the moment of writing it seems to have solved everything perfectly! Well, not everything, but this specific problem is solved, so I would like to say thanks!

You have my gratitude, gentleman!