SetPosition


Sets the location of an object in the 3D world.

 object.SetPosition(x, y, z, speed) 

Parameters

speed

Refers to the rate at which the change in position will be made (in seconds)

x, y, z

The new position of the object in the 3D reference axes

Notes

Alternately, we could write the following:

 object.SetPosition(Other3DObject, speed) 

In this case, the position of our object becomes that of another object.

Sample Code

 oworld = New World(); ocamera = New Camera(oworld); // Create sphere 100 around, and place it at (0,300,0). osphere = oworld.CreateSphere(100,100,100) osphere.Set Position(0,300,0); ocamera.MoveBack(1200); osphere.set gravity(0.01); //Loop While(TRUE)  {   If((osphere.gety) < -100)    {     Osphere.SetPosition(0,300,0);    }  } 



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