Hi,
I'm implementing something that is like a "tractor beam". I've got it pretty much done but I'm have a bit of trouble turning the basis vectors into a rotation matrix (or a quaternion) to apply to the object being "tractored" so that it stays perpendicular to the tractor beam (that's a requirement).
What I have available:
I know the start position of the tractor beam.
I know where it hits my target (intersection) which is an OBB
I know the where it hits my target on the plane facing the source. This gives me a vector of the tractor beam.
I compute the normal to the plane and get the angular difference between the the tractor beam and the normal to the plane
thetaZ = dot_product(plane_normal,tractor_beam) / (L2norm(plane_normal) * L2norm(tractor_beam));
angleZRadians = acos(thetaZ);
make a long story short----I can compute the angle differences for all three basis vectors.....
So my question is, how do I convert this to a rotation matrix I can apply to my target, to keep it perpendicular to the tractor beam?
For instance, the tractor beam is Z axis and the source rotates about the z axis, my computations give me deltas for x and y (say 20 degrees)
and if I try to create a ZYX order rotation I need to rotate X or Y about Z but not both. It seems to me there should be a cleaner way to get a matrix given the difference in angles of two bases. I guess another way to say it is how to create a rotation matrix given two known poses.
Thanks,
Rick