This command causes one object to always look towards another, even if one or both objects move.
object.LookAt(Other3DObject, x, y, z)
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 |
This feature can be useful when you want the camera to follow a moving object.
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);