This command causes your 3D object to follow another object at a controllable distance and position.

 object.Follow(Other3DObject, distance, inertia, x, y, z) 



Number of units to add to the x value of Other3DObject .


Number of units to add to the y value of Other3Dobject .


Number of units to add to the z value of Other3Dobject .


Refers to the lag in following the other object. The lower the number, the more quickly the object s motion will follow Other3DObject s motion. Values of about 40 are usually good.


Refers to the distance to the object

Sample Code

The following code illustrates the command:

 oworld = New World(); ocamera = New Camera(oworld); sphere = oworld.CreateSphere(50,50,50,25,25); //Create second sphere. Sphere2 = oworld.CreateSphere(10,10,10,10,10); ocamera.MoveBack(1200); ocamera.Walk(); sphere.AddPosition(100,200,30,5); //Move it in 5 seconds. // Other sphere follows it. Sphere2.Follow(sphere,50,60,10,10,10); //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 © 2008-2017.
If you may any questions please contact us: