LookAt


This command causes one object to always look towards another, even if one or both objects move.

 object.LookAt(Other3DObject, x, y, z) 

Parameters

x

The offset in the x direction that object is so that it can look at the other object

y

The offset in the y direction that object is so that it can look at the other object

z

The offset in the z direction that object is so that it can look at the other object

Other3DObject

the object that object follows

Notes

This feature can be useful when you want the camera to follow a moving object.

Sample Code

 oworld = New World(); ocamera = New Camera(oworld); sphere = oworld.CreateSphere(50,50,50,25,25); //Create second sphere. brick1 = oworld.CreateBrick(10,10,10,10,10); ocamera.MoveBack(1200); //Move the sphere with the arrow keys. sphere.Walk(); // Brick looks at sphere as sphere moves. brick1.LookAt(sphere); //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