Like the title says. Run the code, hit the up arrow to move the block then wait until it has come to a complete rest. After that the object no longer responds to SetObjectlinearVelocity
// Project: Basic World Setup
// Created: 2016-03-05 By Stab In The Dark Software
//Set window properties
SetWindowTitle( "Basic World Setup" )
SetWindowSize( GetDeviceWidth(), GetDeviceHeight(), 0 )
//Set display properties
SetVirtualResolution ( GetDeviceWidth(), GetDeviceHeight() )
SetVSync( 1 )
//Set Backdrop color
SetClearColor( 0,170,204 ) // light blue
//Set display orientation for mobile device
SetOrientationAllowed( 0, 0, 1, 0 )
SetScissor( 0, 0, 0, 0 )
//Set Lighting
//SetSunDirection( 0, -1, 1 )
CreatePointLight( 1, 0, 200, 0, 1000, 255, 255, 255 )
//SetAmbientColor( 60, 60, 60 )
//Set camera
SetCameraRange( 1, 1, 50000 )
SetCameraPosition(1, 0, 100.0, -250.0)
SetCameraLookAt(1, 0.0, 50.0, 0.0, 0.0)
//Set Text size and color as displayed to screen.
SetPrintSize( 22.0 )
SetPrintColor( 255, 255, 0 )
//Set the error reporting for debugging.
//SetErrorMode( 2 )
Create3DPhysicsWorld(10)
global FPS as integer
global floorBoxID as integer
global floorTexID as integer
global primativeType as integer
floorBoxID = CreateObjectBox( 1000, 12, 1000 )
//SetObjectImage( floorBoxID, floorTexID, 0 )
SetObjectColor( floorBoxID, 112, 100, 100, 255 )
SetObjectLightMode( floorBoxID, 1 )
SetObjectPosition( floorBoxID, 0, -6, 0 )
//This command creates a static physics body for the floor box with a triangle mesh collision shape.
//A static physics body has no mass and does not get moved.
Create3DPhysicsStaticBody( floorBoxID )
//This 3D Physics command changes the collision shape to a primative box shape since we do not need the accuracy of
// polygon collision for just a box. The physics body is still static.
SetObjectShapeBox( floorBoxID ) //
//objectID = LoadObject( "/media/car.3ds", 22.0 )
objectID = CreateObjectBox(10,10,10)
//SetObjectMeshImage( objectID, 1, cartex, 0 )
SetObjectColor( objectID, 255, 3, 239, 255 )
SetObjectPosition( objectID , 0.0, 30, 0.0 )
Create3DPhysicsDynamicBody( objectID )
//This command changes the collison shape to a convex hull.
SetObjectShapeConvexHull( objectID )
objxr as float: objxr = 30
do
if (GetRawKeyState(38))
print("Velocity")
SetObject3DPhysicsLinearVelocity( objectID, 0.5, 0, 0.5, -25 )
endif
SetCameraLookAt(1, getobjectx(objectID), getobjecty(objectID), getobjectz(objectID), 0.0)
FPS = ScreenFPS()
PrintC( "Fame Rate: " ) : Print( FPS )
PrintC( "Total Physics Objects: " ) : Print( Get3DPhysicsTotalObjects() )
PrintC( "Active Physics Objects: " ) : Print( Get3DPhysicsActiveObjects() )
Step3DPhysicsWorld() //required for updating physics.
Sync()
loop