public void adjustNodeToMatch( SceneNode node )
{
int i;
// make sure local values are up to date
if ( !mLocalsUpToDate )
{
calcDirectionAndRadius();
}
// move the parent node to the center point
node.Position = mLocalCP;
// move the corner points to be relative to the node
int numCorners = 4;
if ( mType == PORTAL_TYPE.PORTAL_TYPE_AABB )
numCorners = 2;
else if ( mType == PORTAL_TYPE.PORTAL_TYPE_SPHERE )
numCorners = 2;
for ( i = 0; i < numCorners; i++ )
{
mCorners[ i ] -= mLocalCP;
}
if ( mType != PORTAL_TYPE.PORTAL_TYPE_AABB &&
mType != PORTAL_TYPE.PORTAL_TYPE_SPHERE )
{
// NOTE: UNIT_Z is the basis for our local direction
// orient the node to match the direction
Quaternion q;
q = Math.Vector3.UnitZ.GetRotationTo( mDirection );
node.Orientation = q;
}
// set the node as the portal's associated node
setNode( node );
}