Ok so running into some frustrations with simple rotating of a kinematic object...
Rotate on Y axis no problem, reported angle goes from 0 to 360 degrees.
Rotate on Z axis and object will rotate completely, but reported angle goes from 0 to 180 before switching to -180 (negative) and then counting back to zero.
Rotate on X axis only goes as far as 89.999 degrees, before getting stuck and rotating the Y and Z axis by 180.
Am I missing something here??? I thought this was working not too long ago but I just went back to version 2021-12-06 and not working there either.
// Project: 3D Rotate
// Created: 22-10-23
SetErrorMode(2) // show all errors
SetWindowTitle( "Rotate Object" ) // set window properties
SetWindowSize( 800, 600, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 )
SetPrintSize(20)
create3DPhysicsWorld(40) //Default is 40
Set3DPhysicsGravity(0, -10, 0)
SetAmbientColor(100, 100, 100)
myFloor = CreateObjectPlane(480, 480)
SetObjectPosition(myFloor, 0, 0, 150)
RotateObjectGlobalX(myFloor, 90)
SetObjectColor(myFloor, 38, 38, 38, 255)
Create3DPhysicsStaticBody(myFloor)
SetObjectReceiveShadow(myFloor, 1)
spinner_obj = CreateObjectBox(5, 2.5, 5)
SetObjectPosition(spinner_obj, 0, 5, 0)
SetObjectColor(spinner_obj, 6, 123, 127, 255)
Create3DPhysicsKinematicBody(spinner_obj)
do
Print( ScreenFPS() )
Print( str(GetRawLastKey()) )
print("GetObjectAngleX(spinner_obj) = " + str(GetObjectAngleX(spinner_obj)))
print("GetObjectAngleY(spinner_obj) = " + str(GetObjectAngleY(spinner_obj)))
print("GetObjectAngleZ(spinner_obj) = " + str(GetObjectAngleZ(spinner_obj)))
if GetRawKeyState(88) //X
SetObjectRotation(spinner_obj, GetObjectAngleX(spinner_obj) + 2.0, GetObjectAngleY(spinner_obj), GetObjectAngleZ(spinner_obj))
endif
if GetRawKeyState(89) //Y
SetObjectRotation(spinner_obj, GetObjectAngleX(spinner_obj), GetObjectAngleY(spinner_obj) + 2.0, GetObjectAngleZ(spinner_obj))
endif
if GetRawKeyState(90) //Z
SetObjectRotation(spinner_obj, GetObjectAngleX(spinner_obj), GetObjectAngleY(spinner_obj), GetObjectAngleZ(spinner_obj) + 2.0)
endif
Step3DPhysicsWorld()
Sync()
loop
Check out Automation on Steam now
https://store.steampowered.com/app/1698690/Automation/