I created a room with boxes as walls and used Sparky dll for collision(I used Ruccus' Sparky function). For some reason you can go through the corners of the room. How could I fix this?
sync on : sync rate 60 : autocam off
set camera range .14,3000
for w=10 to 13
make object box w,100,25,3
next w
position object 10,0,0,24: sc_setupobject 10,0,0
position object 11,0,0,-43 : sc_setupobject 11,0,0
position object 12,23,0,0 : yrotate object 12,90: sc_setupobject 12,0,0
position object 13,-45,0,0 : yrotate object 13,90: sc_setupobject 13,0,0
player=1
make object cube player,1
position object player,0,1.5,0
dummy=2
make object cube dummy,1
position object dummy,object position x(player),object position y(player),object position z(player)
do
position object player,object position x(dummy),object position y(dummy),object position z(dummy)
position camera object position x(player),object position y(player),object position z(player)
position object dummy,object position x(dummy),1.5,object position z(dummy)
rotate camera object angle x(player),object angle y(player),object angle z(player)
yrotate object dummy,object angle y(player)
OX# = object position x(dummy)
OY# = object position y(dummy)
OZ# = object position z(dummy)
if upkey()=1 or keystate(17)=1 then move object dummy,0.13
if downkey()=1 or keystate(31)=1 then move object dummy,-0.13
if leftkey()=1 or keystate(30)=1 then move object left dummy,0.13
if rightkey()=1 or keystate(32)=1 then move object right dummy,0.13
X# = object position x(dummy)
Y# = object position y(dummy)
Z# = object position z(dummy)
SlidingCollision(OX#,OY#,OZ#,X#,Y#,Z#,1,dummy,10)
SlidingCollision(OX#,OY#,OZ#,X#,Y#,Z#,1,dummy,11)
SlidingCollision(OX#,OY#,OZ#,X#,Y#,Z#,1,dummy,12)
SlidingCollision(OX#,OY#,OZ#,X#,Y#,Z#,1,dummy,13)
rem control camera using the mouse
yrotate camera object angle y(player)
yrotate object player,object angle y(player)+(mousemovex()/5.0)
xrotate object player,object angle x(player)+(mousemovey()/5.0)
if wrapvalue(object angle x(player))>60.0 and wrapvalue(object angle x(player))<180.0 then xrotate object player,60.0
if wrapvalue(object angle x(player))>180.0 and wrapvalue(object angle x(player))<280.0 then xrotate object player,280.0
sync
loop
function SlidingCollision(X1#,Y1#,Z1#,X2#,Y2#,Z2#,Radius#,Dyn,Obj)
C = sc_SphereSlide(Obj,X1#,Y1#,Z1#,X2#,Y2#,Z2#,Radius#,0)
IF C > 0
cx# = sc_getCollisionSlideX()
cy# = sc_getCollisionSlideY()
cz# = sc_getCollisionSlideZ()
position object Dyn, cx#, cy#, cz#
endif
endfunction
delete memblock 1