pointAtNode derived from ygTransform Example Source Header

Description: a transform that orients to face a node about a point or axis

notes:
Category: Transformation
Author: Alex Hill
Revision: 11/01/01

    Messages
node node, (none | head | body | wand), [integer] clear or set the node and optional user body part
mode (point | axis), three floats set the mode and optional axis
    Comments

constructor pointAtNode

method reset

1 set the rotation mode to point
2 set the rotation axis to the Z-axis
3 clear node name

method message

1 clear or set the node and optional user body part
1.1 if number of arguments is greater than zero
1.1.1 if node type is user then
1.1.1.1 if second argument is "head"
1.1.1.1.1 set node to user head
1.1.1.2 if second argument is "body"
1.1.1.2.1 for each user child
1.1.1.2.1.1 if child is of type body then set node
1.1.1.3 if second argument is "wand"
1.1.1.3.1 if user has a wand then
1.1.1.3.1.1 use specified wand number
1.2 else, clear the node name
2 set the mode and optional axis

method app

1 if a node is set
1.1 get node position vector relative to this node
1.2 get the cross product of the node vector and the rotation axis
1.3 establish the object front as the positive Y-axis
1.4 get the cross product of the front axis and the rotation axis
1.5 get a normal towards the node by crossing this cross with the rotation axis
1.6 get the rotation to the node vector
1.7 create a matrix with this rotation
1.8 if the mode if point then
1.8.1 get the rotation about the node cross product
1.8.2 set the final matrix to this rotation
1.8.3 add this rotation matrix to the existing rotation matrix
1.9 set the dcs matrix