light Bullet3D to check for collision between 2 objects:
+ Code Snippet// set display properties
SetVirtualResolution( 640,360 ) // 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 ) // since version 2.0.22 we can use nicer default fonts
Create3DPhysicsWorld()
Box1 = CreateObjectBox(32,32,32)
Create3DPhysicsKinematicBody(Box1)
Box2 = CreateObjectBox(32,32,32)
SetObjectPosition(Box2,35,0,0)
Create3DPhysicsKinematicBody(Box2)
MoveCameraLocalZ(1,-200)
do
If GetRawKeyState(27) then End
MoveObjectLocalX(Box1, GetRawKeyState(39)-GetRawKeyState(37) ) `RightKey-LeftKey
If GetObjectCollision(Box1,Box2)
SetObjectColor(Box2,255,0,0,255)
Else
SetObjectColor(Box2,255,255,255,255)
Endif
Print("[L/R Arrow] to Slide Box")
Step3DPhysicsWorld()
Sync()
loop
Function GetObjectCollision(a,b)
ThisV3 = CreateVector3()
result = GetObjects3DPhysicsContactPositionVector(a,b,ThisV3)
EndFunction result