[gameprogrammer] Re: Reflect quaternion around a vector

On Tue, Nov 20, 2007 at 05:52:51PM -0800, Kevin Jenkins wrote:

> I have a normal vector for a floor and a quaternion representing the 
> orientation of a camera.  I want the camera to look towards the 
> reflection vector of the camera's current orientation around the floor 
> vector.  How do I do this?

If I understand you correctly, you've got both your camera's current and
desired fwd vector and you need to build a quaternion that rotates the
former vector into the latter one.

If so and if you don't have any other requirements, you can build the
quat from an axis and an angle where the axis is a normalized cross
product of both vectors (watch out for degenerate cases) and the angle
is simply the angle between both vectors (extracted from their dot
product).

Hope this helps,

        latimerius


---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: