SubPosition


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

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

Parameters

x, y, z

Refer to the number of units to add to the object s position in each axis.

time

Refers to the number of seconds for which the movement is to take place. If the time value is omitted, the movement occurs immediately.

Notes

Alternately you can say

 object.SubPosition(another3DObject, time), 

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

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

Sample Code

 oworld = New World(); ocamera = New Camera(oworld); sphere = oworld.CreateSphere(50,50,50,25,25); ocamera.MoveBack(1200); ocamera.Walk(); sphere.SubPosition(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