This command sets the angle of a 3D object relative to the world axes, which are the fixed x, y, z axes of your 3D world.
object.SetAngle(anglex, angley, anglez, time)
anglex , angley , anglez | Refer to the position of the object relative to the x, y, or z axes in radians. |
time | The number of seconds that the command requires. |
Alternately, we can make the angle of the object the same as another 3D object as shown here:
object.SetAngle(other3DObject, time)
oworld = New World(); ocamera = New Camera(oworld); obrick = oworld.CreateBrick(50,50,50); ocamera.MoveBack(1200); // Set the position of the brick. It will be // rotated about all three axes in 5 seconds. Obrick.SetAngle(1,0.5,0.25,5); //Create a second brick and change its angle with a // 3 second delay. obrick2 = oworld.CreateBrick(150,150,50); Obrick2.SetPosition( 150, 150, 0); Obrick2.SetAngle(2,2,2,3); //Loop While(TRUE) { } SetCollision
Turns on or off collision detection for the object.
object.SetCollision(TRUE/FALSE, Collision Type)
TRUE | Applies when collision detection is activated for that object. |
FALSE | Used to disable collision detection for the object. |
Collision Type | The various collision types are as follows : |
Object.COLLISION_TYPE_NONE | |
This is used to disable collision detection for the object. | |
Object.COLLISION_TYPE_SLIDE | |
This causes the object to slide along the surface of the object with which it collides. | |
Object.COLLISION_TYPE_STOP | |
This causes the object to stop its motion when it collides with another object. |
Please note that if you are checking two objects for collision and neither of the objects has been designated a static object (by the SetStatic command), then you must enable collision detection for both of them.
The following sample code enables collision detection for both objects.
oworld = New World(); ocamera = New Camera(oworld); obrick = oworld.CreateSphere(100,100,100); ocamera.MoveBack(1200); //Second brick obrick2 = oworld.CreateSphere(150,150,50); obrick.SetPosition(-100,0,0); obrick2.SetPosition( 200, 0, 0); //Move first brick past the second in 8 seconds, but will //collide. obrick.SetPosition(200,0,0,8); obrick.SetCollision(TRUE,obrick.COLLISION_TYPE_STOP); //Must enable collision detection on second object as well. obrick2.SetCollision(TRUE); //Loop While(TRUE) { }