Quote: "I'm toying with a mobile labyrinth thing. Would be cool to rotate the gravity with GetRawAccelX(), GetRawAccelY() & GetRawAccelZ()!"
Here is an example someone else posted when 3D physics was added.
// Project: Tilt Table
// Created: 2015-10-21
// set window properties
SetWindowTitle( "Tilt Table" )
SetWindowSize( 1024, 768, 0 )
//SetErrorMode( 2 )
// set display properties
SetVirtualResolution( GetDeviceWidth(), GetDeviceHeight() )
SetVSync( 1 )
SetScissor( 0, 0, 0, 0 )
SetOrientationAllowed( 0, 0,1, 0 )
Create3DPhysicsWorld()
//Set3DPhysicsGravity(0,-5,0)
//Build a 'table'
CreateObjectbox( 1, 250,250,10 )
RotateObjectGlobalX(1,90)
SetObjectColor(1,50,50,255,255)
createObjectbox( 2, 250,40,10 )
SetObjectColor(2,20,200,200,255)
RotateObjectGlobaly(2,90)
SetObjectPosition(2,-130,20,0)
createObjectbox( 3, 250,40,10 )
SetObjectColor(3,20,200,200,255)
RotateObjectGlobaly(3,90)
SetObjectPosition(3,130,20,0)
createObjectbox( 4, 250,40,10 )
SetObjectColor(4,20,200,200,255)
SetObjectPosition(4,0,20,130)
createObjectbox( 5, 250,40,10 )
SetObjectColor(5,20,200,200,255)
Setobjectposition(5,0,20,-130)
Create3DPhysicsStaticBody( 1 )
SetObjectShapebox(1)
Create3DPhysicsStaticBody( 2 )
setobjectshapebox(2)
Create3DPhysicsStaticBody( 3 )
setobjectshapebox(3)
Create3DPhysicsStaticBody( 4 )
setobjectshapebox(4)
Create3DPhysicsStaticBody( 5 )
setobjectshapebox(5)
//position camera
SetCameraPosition( 1, 0,260,0 )
SetCameraLookAt( 1, 0,0,0, 0 )
// set up time and index variables
time = 0
gravcheck=0
index = 10
// main loop
do
// increment time
time = time + 1
gravcheck=gravcheck+1
// release a new ball every so often
if ( time >= 10 and index < 40)
CreateObjectSphere ( index, random(15,40),15,15 )
SetobjectPosition ( index, 0, 60,0 )
Create3DPhysicsDynamicBody(index)
SetObjectShapeSphere(index)
SetObjectColor(index,random(50,200),random(50,200),random(50,200),255)
// increment index and reset time
index = index + 1
time = 0
endif
if (gravcheck > 15)
Set3dPhysicsGravity ( GetDirectionx()*20.0, -10.0, getdirectiony()*-20.0 )
endif
Step3DPhysicsWorld()
Sync ( )
loop
The coffee is lovely dark and deep,and I have code to write before I sleep.