Recommended Posts

Say I have two vectors (vecForward and vecToTarget)
I know how to calculate the quaternion between them (dQ), and I simply multiply the difference quaternion by the current quaternion (Q) to realign my forward vector parallel to the target vector.
That change is instantaneous; I may need to convert dQ to axis angles in order to make sure the rotation doesn't exceed the max angular velocities around each axis (yaw/pitch/roll rates may be different). I suspect that theory isn't feasible, though, and I'm not sure where to go with it.
*
Also (and maybe this bit would be better off in the AI section), does anyone know of a ground-up tutorial on steering behaviors and collision avoidance? I've looked at a lot of code, and Craig Reynolds' website has been helpful, but anything else would be appreciated.
Thanks

The first line finds a vector between my location and the target's. The second line finds the quaternion between the two, and the third line modifies the current orientation by that quaternion.

I'm thinking of modifying the code so that I'm setting a goal orientation rather than a goal rotational velocity. This could be converted to an axis angle, which could theoretically be broken down so that I can compare each component to MaxRotSpeed.

0

Share this post

Link to post

Share on other sites

Share this post

Link to post

Share on other sites

I'm not quite following either, but if the goal is to restrict the local-axis rotations (yaw, pitch, and roll) to some maximum speed, then perhaps it would be better to handle the steering in terms of ypr in the first place, rather than via the (arbitrary) axis-angle rotations you're using currently.

Given a current orientation and a target, you can compute the yaw, pitch, and/or roll that will align the object with the target by projecting the vector-to-target onto the appropriate planes, and then using the atan2() function to compute the angle. You can fully align the object with the target using any two of the three rotations (for example, pitch and roll only). By breaking the steering down into these local-axis rotations, you can then easily apply rotational constraints as needed.

Share this post

Link to post

Share on other sites

The rotations represented by quaternions won't map smoothly into the yaw, pitch, and roll rates, because of limitations in using a yaw/pitch/roll representation. Yaw, pitch, and roll don't give smooth rotations since the order in which they are applied changes the effects that a change in each of them would have. If you're looking straight up, is that 90 degrees pitch or 180 degrees of roll and yaw?

To do this properly, with different rates of movement for yaw, pitch, and roll, a better model for thinking about this would be as 3 separate rotational joints. Think of it like a robot arm, where these joints are applied in a particular order. When trying to rotate to a certain direction, convert that direction vector to the robot's coordinate space to get the rotation relative to its current position. Now compute the needed rotations for each axis in whatever order you are applying them in to get three angle deltas.

0

Share this post

Link to post

Share on other sites

Original post by VorpyThe rotations represented by quaternions won't map smoothly into the yaw, pitch, and roll rates, because of limitations in using a yaw/pitch/roll representation. Yaw, pitch, and roll don't give smooth rotations since the order in which they are applied changes the effects that a change in each of them would have. If you're looking straight up, is that 90 degrees pitch or 180 degrees of roll and yaw?

Just to clarify for the OP, the 'yaw, pitch, and roll' I referred to in my earlier post are local-axis (relative) rotations, and therefore aren't subject to the kinds of problems described above (well, technically speaking, order does matter when applying local rotations as well, but these effects can usually be safely ignored).

0

Share this post

Link to post

Share on other sites

ok, what you really need is to in first calculate the rotational velocity (or at least direction) that will "eventually" make u rotate from one vector to another. Once you have that, multiply by dt, take length and convert to quaternion (if needed) using a general {axis, angle} method: