AddAngle


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

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

Parameters

xangle

Number of radians to add about the x-axis

yangle :

Number of radians to add about the y-axis

zangle

Number of radians to add about the z-axis

time

Number of seconds for rotation

Notes

There is another way to express this function. You might say,

 object.AddAngle(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 command. The AddAngle command moves the object about the stationary world axes. The SetRelativeAngle command moves the object about its own x, y, and z axes. Please consult the explanation for the SetRelativeAngle command later in this appendix to see sample code that allows you to see the differences between the two commands. The same applies to the SetAngle command, which is also made in reference to the world axes.

You should also realize that you do not really need the SubAngle command, which turns the object in the opposite directions: 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.AddAngle(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