At 12:23 PM -0600 4/18/06, Chris Halford wrote:
I was hoping to use the orientation as I have an object that needs to point in one of 6 directions and smoothly rotate from one to the other. I didn't want to necessarily track what way it was facing, but rather get it to rotate to an absolute orientation. It is only a little more code to do it using yaw, pitch and roll, so I'm OK with this.
You can do this with Quaternion.SetRotateAboutAxis to set up a target orientation, and then use Quaternion.SetBetween to do the interpolation. If you're happy with the current solution, then super, but if you decide you want to pursue SetBetween and need some additional guidance, feel free to ask.
On the same topic. What is the normal way to get a smooth rotation in a 3d space? I can just loop through a rotation with updates after each adjustment, or I can use a timer firing N times. Using a timer seems to be a good way to control the speed, but then I have to either disable further commands to rotate when it isn't done, or dynamically recalculate where it is rotating to.
I'd use the timer, but when the user clicks a new direction (or whatever causes a new target orientation to be chosen), reset the "start" orientation to a copy of the object's current orientation.
OK, that seems unclear, so let me back up and try again. SetBetween interpolates between two orientations; so you need three things: a start orientation, a target orientation, and the fraction (a value from 0-1) that indicates how far you want to be from the start to the target. So, to do this smooth rotation, you set up a QStart by copying the current orientation, a QTarget by whatever it is that defines the target, and set your Fraction to zero. Then start your timer, and in its Action, you do Fraction = Fraction + 0.1 (or whatever), use SetBetween to set the appropriate orientation on your object, and update the RB3DSpace.
That should do it; if the target changes halfway through, you just go through the same procedure of copying the current orientation to QStart, and setting the new QTarget, and reset Fraction to zero, and now it'll interpolate from wherever it is to the new target.
HTH, - Joe -- Joseph J. Strout [EMAIL PROTECTED] _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html>
