Tractor Beam

Started by
0 comments, last by RickF- 8 years, 1 month ago

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

Advertisement

Well I might have found my own answer, but if someone would confirm that would be great.

It seems I need to take the vectors of the new basis and put them as column vectors in matrix M. Then take the Inverse (transpose in this case) and use this matrix. I wonder if this would need to be a Quaternion since my tractor beam source can move in a complete orbit around the target?

This topic is closed to new replies.

Advertisement