I forgot you must use - object collision - command
set display mode 1024,768,32
Sync On : CLS 0
Sync Rate 60
AutoCam Off
Hide Mouse
Make Matrix 1,2000,2000,20,20
Create Bitmap 1,128,128
CLS RGB (0,128,0)
Get Image 1,0,0,128,128
Set Current Bitmap 0
Delete Bitmap 1
Prepare Matrix Texture 1,1,1,1
Make Object Cube 1,3 :rem our cube
Position Object 1,1000,3,990
set object collision on 1
Color Object 1, RGB (255,0,0)
Make Object Cube 2,3
Position Object 2,1000,3,1000
set object collision on 2
Position Camera 1000,50.0,980
Point Camera 1000,3,980
global hitflag
Do
If Upkey()=1 Then Move Object 1,0.1
If Downkey()=1 tHEN MOVE OBJECT 1,-0.1
iF Leftkey()=1 Then YRotate Object 1, WrapValue(Object Angle Y(1)-2.0)
If Rightkey()=1 Then YRotate Object 1, WrapValue(Object Angle Y(1)+2.0)
ObjPosX#=Object Position X(1)
ObjPosY#= Object Position Y(1)
ObjPosZ#=Object Position Z(1)
Position Camera ObjPosX#,30.0,ObjPosZ#
hitflag=object collision(1,2)
gosub collisioncheck
sync
Loop
collisioncheck:
If hitflag=1 then text 500,200,"hitflag=1"
If hitflag=1 and colorflag=0 then Color object 2,rgb(0,0,0):colorflag=1:return
If hitflag=0 then text 500,200,"hitflag=0"
If hitflag=0 and colorflag=1 then Color Object 2,rgb(255,255,255):colorflag=0:return
return
End