Quote: "Something like: "getCollision(obj1,obj2)""
in case you're not working on a full-blown 3d
physics project, there
IS an easy way to return whether or not 2 objects are colliding but it does use a few commands from the 3d physics command set:
// set display properties
SetVirtualResolution( 1080, 720 ) // 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)
ThisV3 = CreateVector3()
MoveCameraLocalZ(1,-200)
do
MoveObjectLocalX(Box1, GetRawKeyState(39)-GetRawKeyState(37) ) `RightKey-LeftKey
If GetObjects3DPhysicsContactPositionVector(Box1,Box2,ThisV3) = 1
SetObjectColor(Box2,255,0,0,255)
Else
SetObjectColor(Box2,255,255,255,255)
Endif
Step3DPhysicsWorld()
Sync()
loop
specifically:
GetObjects3DPhysicsContactPositionVector()
fubarpk's
GetObject3DPhysicsContactObjectB method above is generally more involved, cycling through potentially numerous contacts, extracting object #'s, etc.. it will work the same but if you're looking for
getCollision(obj1,obj2) behavior, i'd keep it simple.