vectorNavigator derived from ygCAVENavigator Example Source Header

Description: a navigator that takes a direction and rotation vector

Category: User
Author: Alex Hill
Revision: 07/01/06 Alex Hill - disabled navigation updating for distributed clients

direction three floats set the direction vector
rotation three floats set the rotation vector
orientation three floats set the absolute orientation

constructor vectorNavigator

destructor ~vectorNavigator

method reset

1 set directon vector to 0,0,0
2 set rotation vector to 0,0,0

method message

1 set the direction vector
2 set the rotation vector
3 set the absolute orientation

method app

0.1 process direction and orientation input
0.2 if fly mode is false then adjust height to any ground collision
0.3 if collision detection is on then test for object collisions

method checkInput

1 extract X and Z vector components
2 add X and Z components to forward vector (0,1,0)
3 transform direction vector by current navigation matrix and normalize
4 multiply existing navigation matrix by new heading and pitch matrix
5 use Y vector component to create rotation matrix
6 multiply existing navigation matrix by new roll matrix
7 calculate translation component
8 if fly mode is false then zero the Z component
9 transform the direction vector by the user matrix
10 multiply existing navigation matrix by new translation matrix
11 update navigation coordinates