DarkBASIC Professional Help Wiki
Advertisement


This command will return sliding data for X if the rotated-box flag is zero.

Syntax
Return Float=GET OBJECT COLLISION X()
Returns

The sliding data for x if the rotated-box flag is zero

Description

The rotated-box flag is set when you used the command MAKE OBJECT COLLISION BOX. You must have used the make command in order to generate a return value here.

Example Code
sync on : sync rate 60 : hide mouse:cls 0

autocam off

set global collision on

ObjectNumber=1

SecondObject=2

make object sphere ObjectNumber,10

color object ObjectNumber,rgb(0,255,0)

position object ObjectNumber, 0,0,0

make object cone secondObject,10

xrotate object secondObject,90

fix object pivot secondObject

color object SecondObject,rgb(255,0,0)

position object SecondObject, 15,0,0

make object collision box ObjectNumber, -5,-5,-5,5,5,5,0

make object collision box SecondObject, -5,-5,-5,5,5,5,0

while mouseclick()=0

set cursor 0,0

if leftkey()=1 then turn object left SecondObject,1

if rightkey()=1 then turn object right SecondObject,1

if upkey()=1 and OBJECT HIT(SecondObject,0)=0 then move object SecondObject,1

if downkey()=1 and OBJECT HIT(SecondObject,0)=0 then move object SecondObject,-1

if spacekey()=1 then move camera 0,1

if returnkey()=1 then position object SecondObject,15,0,0

if OBJECT COLLISION(SecondObject,0)

print "OBJECT COLLISION"

print "GET OBJECT COLLISION X",GET OBJECT COLLISION X()

print "GET OBJECT COLLISION Y",GET OBJECT COLLISION y()

print "GET OBJECT COLLISION Z",GET OBJECT COLLISION z()

endif

position camera object position x(SecondObject),object position y(SecondObject)+50,object position z(SecondObject)
Advertisement