I've got code for object - object accurate collision which should help

i got it from the code snippets column and modified it.
Put this code before the main loop:
checks=16
if checks<4 then checks=4
if checks>360 then checks=360
`width of the angles
angwidth=360/checks
`make arrays for collision data
dim ang#(checks-1,2)
dim sort#(checks-1,2)
objN#=[char model number]
gravity#=1
spd#=0.1
radius#=1.5
colsmooth#=1
this bit of code somewhere in the main loop:
obj=[level object number]
gosub _objcollision
and this after the main loop:
_objramp:
`get positions again
objx#=object position x(objN#)
objz#=object position z(objN#)
`Get your old height
oldht#=object position y(objN#)
`calc new height using intersect object from the old height down charht# units
sub#=intersect object(obj,objx#,oldht#,objz#,objx#,oldht#-(charht#*2),objz#)
ht#=(oldht#+charht#)-sub#
if sub#=0 then ht#=charht#
`do some gravity
grav#=grav#-0.25
`if you are going up a ramp
if oldht#+grav#<ht#
grav#=0.0
position object objN#,objx#,ht#,objz#
else
`if you are falling
ht#=oldht#+grav#
position object objN#,objx#,ht#,objz#
endif
return
_objcollision:
`make 72 collision points. You can use more or less, but this number seems to work good.
`These are vectors every 5 degrees from the camera position out.
`They return the distance when they hit an object
for x=0 to checks-1
chx#=newxvalue(objx#,x*angwidth,1)
chz#=newzvalue(objz#,x*angwidth,1)
ang#(x,1)=intersect object(obj,objx#,objy#,objz#,chx#,objy#,chz#)
if ang#(x,1)=0 then ang#(x,1)=999999
ang#(x,2)=x*angwidth
sort#(x,1)=ang#(x,1)
sort#(x,2)=ang#(x,2)
next x
`sort the array to find the closest object and it's degrees
for x=0 to checks-2
for y=x+1 to checks-1
if ang#(x,1)>ang#(y,1)
temp#=ang#(x,1)
temp2#=ang#(x,2)
ang#(x,1)=ang#(y,1)
ang#(x,2)=ang#(y,2)
ang#(y,1)=temp#
ang#(y,2)=temp2#
endif
next x
next y
`find +-90 degrees from the closest one for when you walk into a corner so it doesn't shake
prev=wrapvalue(ang#(0,2)-90)/angwidth
nxt=wrapvalue(ang#(0,2)+90)/angwidth
newd#=(radius#-ang#(0,1))/colsmooth#
newa#=wrapvalue(ang#(0,2)-180)
newd1#=(radius#-sort#(prev,1))/colsmooth#
newa1#=wrapvalue(sort#(prev,2)-180)
newd2#=(radius#-sort#(nxt,1))/colsmooth#
newa2#=wrapvalue(sort#(nxt,2)-180)
`if you are less than radius from a wall, push you out to 20 from it
if ang#(0,1)<radius# and ang#(0,1)>0.0
repx#=newxvalue(objx#,newa#,newd#)
repz#=newzvalue(objz#,newa#,newd#)
position object objN#,repx#,objy#,repz#
endif
objx#=object position x(objN#)
objz#=object position z(objN#)
`this is if you are coming into a corner, this pushes you sideways
if sort#(prev,1)<radius# and sort#(prev,1)>0.0
repx1#=newxvalue(objx#,newa1#,newd1#)
repz1#=newzvalue(objz#,newa1#,newd1#)
position object objN#,repx1#,objy#,repz1#
endif
objx#=object position x(objN#)
objz#=object position z(objN#)
`and the other way. above is left, this is right
if sort#(nxt,1)<radius# and sort#(nxt,1)>0.0
repx2#=newxvalue(objx#,newa2#,newd2#)
repz2#=newzvalue(objz#,newa2#,newd2#)
position object objN#,repx2#,objy#,repz2#
endif
gosub _objramp
return
hope this helps
Once you start down the Dark Path, forever will it dominate your destiny...