Hello!
i'm making a test with movement and collisions, but i just can't get the collision code work.
i'm trying to prevent the crush between object 1 and 3, but the object3 catches the object1 when object1 turns. so can someone tell me how to make the collision between those two?
so the code goes like this:
Rem Project: sight
Rem Created: Wednesday, April 01, 2009
Rem ***** Main Source File *****
sync on
sync rate 40
make matrix 1,1000,1000,100,100
make object cube 1,30
make object cube 3,30
scale object 3,130,130,300
position object 3,0,0,-75
Load object "MEDIA\Sight.3ds",2
scale object 2,2500,2500,2500
YROTATE OBJECT 2,270
Kiihtyvyyseteen# = ke#
ke#=0
kaannosvasemmalle# = kv#
kv#=1
kaannosoikealle# = ko#
ko#=1
hidastus=0
do
if object collision(3,1) then hidastus=1
if hidastus = 1
endif
if hidastus = 0
set object speed 3,object speed (1)
endif
if upkey()=1 then ke#=ke#+0.009
if upkey()=0 then ke#=ke#-0.009
if ke#=>0 then move object 1,ke#
if ke#=>0 then move object 3,ke#
if spacekey()=1 then ke#=ke#-0.1
if ke#=>5 then ke#=5
if ke#=<0 then ke#=0
if rightkey()=1 and ke#=<1.5 then YROTATE OBJECT 1,OBJECT ANGLE Y(1)+1.5
if rightkey()=1 and ke#=<1.5 then YROTATE OBJECT 2,OBJECT ANGLE Y(2)+1.5
if rightkey()=1 and ke#=>1.5 then YROTATE OBJECT 1,OBJECT ANGLE Y(1)+1
if rightkey()=1 and ke#=>1.5 then YROTATE OBJECT 2,OBJECT ANGLE Y(2)+1
if rightkey()=1 and ke#=>3 then YROTATE OBJECT 1,OBJECT ANGLE Y(1)+0.5
if rightkey()=1 and ke#=>3 then YROTATE OBJECT 2,OBJECT ANGLE Y(2)+0.5
if leftkey()=1 and ke#=<1.5 then YROTATE OBJECT 1,OBJECT ANGLE Y(1)-1.5
if leftkey()=1 and ke#=<1.5 then YROTATE OBJECT 2,OBJECT ANGLE Y(2)-1.5
if leftkey()=1 and ke#=>1.5 then YROTATE OBJECT 1,OBJECT ANGLE Y(1)-1
if leftkey()=1 and ke#=>1.5 then YROTATE OBJECT 2,OBJECT ANGLE Y(2)-1
if leftkey()=1 and ke#=>3 then YROTATE OBJECT 1,OBJECT ANGLE Y(1)-0.5
if leftkey()=1 and ke#=>3 then YROTATE OBJECT 2,OBJECT ANGLE Y(2)-0.5
point object 3,object position x(1),object position y(1),object position z(1)
Position object 2, object position x(1), object position y(1), object position z(1)
position camera 0,object position x(1), object position y(1)+200, object position z(1)-200
point camera 0,object position x(1), object position y(1), object position z(1)
sync
loop
you can delete object2 from the code it's not important.