FANDOM



This command will make an object use box collision.

Syntax
MAKE OBJECT COLLISION BOX Object Number, X1, Y1, Z1, X2, Y2, Z2, Collision Flag
Parameters
Object Number

Integer
The object number X1 Float
The first x value from the center of the object Y1 Float
The first y value from the center of the object Z1 Float
The first z value from the center of the object X2 Float
The second x value from the center of the object Y2 Float
The second y value from the center of the object Z2 Float
The second z value from the center of the object Collision Flag Integer
If the flag value is one, the box is deemed to be a rotated-box and will provide more accurate collision feedback as the object rotates

Returns

This command does not return a value.

Description

If a value of zero is specified for the flag value, the box will be deemed to be a non-rotating box and able to generate sliding collision data using the GET OBJECT COLLISION X, Y and Z expressions. If the flag value is one, the box is deemed to be a rotated-box and will provide more accurate collision feedback as the object rotates. Be aware that the collision box you create is affected by the subsequent scaling of the object, and that when the object is rotated the fixed collision box orientation remains unrotated to aid in the effect of sliding collision.

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 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

sync

endwhile

delete object collision box ObjectNumber

delete object collision box SecondObject

set global collision off

delete object ObjectNumber

delete object SecondObject

end