AddPosition


This command increases the x, y, and z coordinates of a 3D object. It changes the position immediately or at a speed that you can specify.

 object.AddPosition(x,y,z,time) 

Parameters

x

Number of units to add to the x-axis

y

Number of units to add to the y-axis

z

Number of units to add to the z-axis

time

Number of seconds for the motion to take

Notes

If the time parameter is omitted, the movement occurs immediately.

Alternately, you can say,

 object.AddPosition(another3DObject, time), 

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

The SubPosition command is very similar to this one, but it moves the object in the opposite direction. You do not really need it since using negative numbers in this command will result in the same motion.

Sample Code

 oworld = New World(); ocamera = New Camera(oworld); sphere = oworld.CreateSphere(50,50,50,25,25); ocamera.MoveBack(1200); ocamera.Walk(); sphere.AddPosition(100,200,30,5); //move 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