Alright, i made this crappy little program here and i needed sliding collision, so i look around the forum. I came across the thread 'Sliding collision made easy' in the snippets forum, and i used the functions in it. All seemed to be well, the big sphere collied well with the little ones, and worked fine against the top and bottom walls, but the two side walls don't seem to be working right. The collision boxes have been rotated on the y axie 90ยบ, but the walls them selves havent moved... I really need help with this...
sync on : sync rate 0
field#=1
player#=10
make object sphere player#,8
CollBox(player#)
make object box field#,150,2,150
color object field#,rgb(150,150,150)
for t=1 to 4
make object box 200+t,150,30,2
color object 200+t,RGB(1,24,186)
CollBox(200+t)
next t
for u=1 to 10
make object sphere 20+u,3
position object 20+u,rnd(140),4,rnd(140)
CollBox(20+u)
next u
position object 201,75,15,150
position object 202,0,15,75
position object 203,75,15,0
position object 204,150,15,75
position object player#,15,2,135
position object field#,75,0,75
yrotate object 202,90
yrotate object 204,90
position camera 75,250,75
xrotate camera 90
do
SlideColl(player#)
if upkey()=1 then move object player#,0.5
if downkey()=1 then move object player#,-0.5
if leftkey()=1 then move object left player#,0.5
if rightkey()=1 then move object right player#,0.5
sync
loop
`this is the function for the collision box
Function CollBox(ob#)
obsx#= Object Size X(ob#): Rem Find the object size X
obsy#= Object Size Y(ob#): Rem Find the object size Y
obsz#= Object Size Z(ob#): Rem Find the object size Z
Make object Collision Box ob#,0-(obsx#/2),0-(obsy#/2),0-(obsz#/2),(obsx#/2),(obsy#/2),(obsz#/2),0
endfunction
`Now that the collision box is made, the function can be put in the main loop
Function SlideColl(pn#) : Rem pn# is PLAYER NUMBER
obx#= Object position x(pn#) : Rem Get the objects X position
oby#= Object position y(pn#) : Rem Get the objects Y position
obz#= Object position z(pn#) : Rem Get the objects Z position
If object collision(pn#,0)>0 : Rem here you may put NOT any objects you dont want collision with
dec obx#,get object collision x()
dec oby#,get object collision y()
dec obz#,get object collision z()
position object pn#,obx#,oby#,obz#
endif
endfunction