gravity derived from ygTransform Example Source Header

Description: a transform that moves down to the first floor intersection found

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

    Messages
upright [bool] set the angle of the object to the surface or upright
toggleUpright toggle the upright mode
fly [bool] set the fly mode to enable or disable gravity
togglefly toggle the fly mode
speed float set the speed in feet/second
height float set the height above the surface
    Comments

constructor gravity

method reset

1 set height to zero
2 set speed to 1.0 feet/second
3 set upright to true

method message

1 set the angle of the object to the surface or upright
2 toggle the upright mode
3 set the fly mode to enable or disable gravity
4 toggle the fly mode
5 set the speed in feet/second
6 set the height above the surface

method app

1 if not in fly mode then check for ground

method checkGround

1 set up intersection segment
2 get self matix
3 get parent matrix
4 if an intersection with an object is found
4.1 Get the intersection transformation matrix.
4.2 if not upright then adjust the angle to the surface normal
4.3 Set the new transformation and return.