SubAngle


This command decreases the angle of the object relative to the world axis. It changes the angle immediately or at a speed that you can specify.

 object.SubAngle(xangle, yangle, zangle, time) 

Parameters

xangle, yangle, zangle

Refer to the number of radians to subtract from the object s orientation about each axis.

tim e

Refers to the number of seconds for which the rotation is to take place.

Notes

Alternately, you can say:

 object.SubAngle(another3DObject, time), 

where another3DObject refers to another object from which to add the angle.

It is important to know that there is a difference between the SetRelativeAngle command and the AddAngle and SubAngle commands. The SubAngle command moves the object about the stationary world axes. The SetRelativeAngle moves the object about its own x, y, and z axes. Please consult the explanation for the SetRelativeAngle command to see sample code that allows you to see the differences between the SetRelativeAngle and the SubAngle commands.

You should also realize that you do not really need the SubAngle command ”the AddAngle command will do the same motion if you use negative numbers .

Sample Code

 oworld = New World(); ocamera = New Camera(oworld); sphere = oworld.CreateSphere(50,50,50,25,25); ocamera.MoveBack(1200); ocamera.Walk(); sphere.SubAngle(1,2,3,5); //Rotates it in 5 seconds. //Rotate it in the opposite direction. //sphere.SubAngle(-1,-2,-3,5); //Rotates it in 5 seconds. //Loop While(TRUE); 



Elementary Game Programming and Simulators Using Jamagic
Elementary Game Programming & Simulations Using Jamagic (Charles River Media Game Development)
ISBN: 1584502614
EAN: 2147483647
Year: 2002
Pages: 105
Authors: Sergio Perez

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net