Sets gravity (motion down) on an object.
object.SetGravity(speed)
speed | Refers to the rate at which the object will drop. |
The larger the value, the faster the drop. Please note that using negative values will cause the object to rise instead of drop.
The following code will drop the sphere using the gravity command until it reaches a y value of “100, at which point it will be moved back to its starting point.
Please note as well that the Stop command will not stop an object under the gravity command. You must stop it by setting gravity to zero.
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); } }