Ok. Long code segment. I'm trying to use collision detection on 2d dimensional 3d rendered triangles in the same plane (no Z is used). Try my code. Can you explain why it doesn't collide properly? It switches from default to poly based detection halfway through.
Is this a bug in dark basic? Should I try it with objects that have a dimension in the Z axis?
See code...
sync on
MAKE OBJECT TRIANGLE 7, -3,0,0, 4,3,0, 5,-1,0
MAKE OBJECT TRIANGLE 9, -3,0,0, 4,7,0, 6,-1,0
sync
sync
wait 100
`wait key
position object 7, 0,-8,20
position object 9, 0,-18,20
sync
sync
wait 100
show object bounds 7
show object bounds 9
position object 9, 0 , -12 , 1
wait 500
`----------------------------------------------------------
position object 7, -6, 6, 1
Collided3 = 0
repeat
position object 7, object position x(7) , object position y(7) - .1 , object position z(7) ,
Collided3 = Object HIT( 7 , 0 )
sync
sync
wait 1
until Collided3 <> 0
wait 1000
`----------------------------------------------------------
position object 7, -5, 6, 1
Collided3 = 0
repeat
`if Collided3 = 0
position object 7, object position x(7) , object position y(7) - .1 , object position z(7) ,
Collided3 = Object HIT( 7 , 0 )
`endif
sync
sync
wait 1
until Collided3 <> 0
wait 1000
`----------------------------------------------------------
position object 7, -4, 6, 1
Collided3 = 0
repeat
`if Collided3 = 0
position object 7, object position x(7) , object position y(7) - .1 , object position z(7) ,
Collided3 = Object HIT( 7 , 0 )
`endif
sync
sync
wait 1
until Collided3 <> 0
wait 1000
SET OBJECT COLLISION TO POLYGONS 7
SET OBJECT COLLISION TO POLYGONS 9
`----------------------------------------------------------
position object 7, -6, 6, 1
Collided3 = 0
repeat
`if Collided3 = 0
position object 7, object position x(7) , object position y(7) - .1 , object position z(7) ,
Collided3 = Object HIT( 7 , 0 )
`endif
sync
sync
wait 3
until Collided3 <> 0
wait 1000
`----------------------------------------------------------
position object 7, -5, 6, 1
Collided3 = 0
repeat
`if Collided3 = 0
position object 7, object position x(7) , object position y(7) - .1 , object position z(7) ,
Collided3 = Object HIT( 7 , 0 )
`endif
sync
sync
wait 3
until Collided3 <> 0
wait 1000
`----------------------------------------------------------
position object 7, -4, 6, 1
Collided3 = 0
repeat
`if Collided3 = 0
position object 7, object position x(7) , object position y(7) - .1 , object position z(7) ,
Collided3 = Object HIT( 7 , 0 )
`endif
sync
sync
wait 3
until Collided3 <> 0
wait key