Rem Project: Dark Basic Pro Project
Rem Created: Monday, October 11, 2010
rem randoooooooooooommmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
Rem ***** Main Source File *****
`%ProjectTitle%
`======================
`%Author%
`======================
`Source File Name
//autocam off
set display mode 1280, 800, 16
load object "Car.x", 1
load object "Straight.x", 2
set camera range 1, 10000
position object 1, 0, 0, -626
yrotate object 1, 90
sc_setupobject 1,0,0
sc_setupobject 2,0,0
//set camera to follow object position x(1), object position y(1), object position z(1), 0, 10, 10, 10, 0
ang = 90
do
oldx# = object position x(1)
oldy# = object position y(1)
oldz# = object position z(1)
if upkey() = 1 then move object 1, 2
if leftkey() = 1
turn object left 1, 1
ang = ang - 1
endif
if rightkey() = 1
turn object right 1, 1
ang = ang + 1
endif
if downkey() = 1 then move object 1, - 2
sc_updateobject 1
sc_updateobject 2
print object position z(1)
set camera to follow object position x(1), object position y(1), object position z(1), ang, 70, 50, 10, 0
//if sc_objectcollision(1,0) = 2 then position object 1, oldx#, oldy#, oldz#
//phy make rigid body static box 1
Slide(1,0,oldx#,oldy#,oldz#,x#,y#,z#,object size(1),1)
loop
Function Slide(obj,checkobj,oldx#,oldy#,oldz#,x#,y#,z#,radius#,exlude)
collide = sc_spherecast(checkobj,oldx#,oldy#,oldz#,x#,y#,z#,radius#,exlude)
if collide>0
x# = sc_getcollisionslidex()
y# = sc_getcollisionslidey()
z# = sc_getcollisionslidez()
position object obj, x#, y#, z#
sc_updateobject obj
endif
endfunction
There you go, use sc_spherecast() instead of sc_ObjectCollision()