first, I have to tell you that I speak french ; I'll do some errors in my translation, but ... I'm sure that you are enough smart to understand what I'll say }:>
the ones who had dbc before dbp remimber the example number 25 about the sliding collisions, it was good, but it can be better

the big problem with this code is that you can climb a crate from it's side, there is no difference between the top or the bottom of a crate and it's side.
I made a code with trigonometry that look which side is hit. there's only one small problem : the player can hit only one box at the same time, or there will be a problem (but it can be repared with a for next loop (I don't use this system because it's a bit slower and in my game, I won't hit two boxes at the same time))
because I'm a man very kind, I give you this code, with an example :
`»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
`» 04-08-2003 // 19:11:45 »
`» code made by Atreides »
`» I hope that you will »
`» enjoy this small code

»
`»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
autocam off
set display mode 1024,768,16
sync on
sync rate 50
set text size 18
rem the universal texture

create bitmap 1,128,128
set current bitmap 1
for x=1 to 128
for y = 1 to 128
dot x,y,rgb(rnd(255),rnd(255),rnd(255))
next y
next x
get image 1,1,1,128,128
set current bitmap 0
rem the play : the sphere
make object sphere 1,5
texture object 1,1
position object 1,0,15,0
rem the ground
make object box 2,250,4,250
texture object 2,1
rem be careful : if the player can hit two boxes at the same time => problem
make object box 3,20,40,20
position object 3,15,35,0
texture object 3,1
make object cube 4,18
position object 4,0,20,30
texture object 4,1
make object cube 5,16
position object 5,0,30,90
texture object 5,1
make object cube 6,14
position object 6,-60,40,90
texture object 6,1
make object cube 7,12
position object 7,-120,50,90
texture object 7,1
do
rem we ask the coordinates of the object
x# = object position x(1)
y# = object position y(1)+grav#
z# = object position z(1)
rem as in the dbc's example

dec grav#,0.0981
rem the object must me moved by modification of its coordinates
if upkey()=1 then x# = x# + sin(object angle y(1))
if upkey()=1 then z# = z# + cos(object angle y(1))
if downkey()=1 then x# = x# - sin(object angle y(1))
if downkey()=1 then z# = z# - cos(object angle y(1))
if leftkey()=1 then yrotate object 1,wrapvalue(object angle y(1)-3)
if rightkey()=1 then yrotate object 1,wrapvalue(object angle y(1)+3)
position object 1,x#,y#,z#
rem have you ever dreamed to fly ?
if controlkey()=1 then grav# = 0.5
rem caméra
set camera to follow x#,object position y(1),z#,object angle y(1),50,object position y(1)+10,10,0
point camera x#,y#,z#
rem here's the code

coll = object collision(1,0)
if coll > 0
dax# = dax(1,coll)
ax# = ax(coll)
day# = day(1,coll)
ay# = ay(coll)
daz# = daz(1,coll)
az# = az(coll)
rem is the player on the crate ?
if dax# > (360 - ax#) or dax# = (360 - az#) or daz# = az# and daz# ay# and day# (180+az#)
if day# (180+ay#)
x# = object position x(coll) - (object size x(coll)/2) - (object size x(1)/2)
position object 1,x#,y#,z#
endif
endif
rem face z - 1
if dax# (180+ax#)
if day# (180-ay#)
z# = object position z(coll) - (object size z(coll)/2) - (object size z(1)/2)
position object 1,x#,y#,z#
endif
endif
rem la face Z + 1
if dax# > ax# and dax# (360-ay#) or day# (180-az#)
if dax# (180-ax#)
rem -0.01 pour que le contacte se coupe, sinon, avec grav# = 0, on reste collé

y# = object position y(coll) - (object size y(coll)/2) - (object size y(1)/2) -0.01
position object 1,x#,y#,z#
rem mais attention, quand on s'éclate au plafond, on retombe tout de suite
rem sauf dans les dessins animés, quand le héro passe à travers le toit

grav# = 0
endif
endif
endif
sync
loop
remstart
I'm sorry, but I cannot explain it well.. the 3 first functions give the
angles between the center of the object and one of its corners ; the 3 last
give the angles between the 2 objects .. it are the functions that are used upper
remend
function ax(obj)
sz# = object size z(obj)/2
sy# = object size y(obj)/2
if sz# > 0
if sy# > 0 then angle# = atan(sz#/sy#)
if sy# 0 then angle# = 360 - atan(abs(sz#)/sy#)
if sy# 0 then angle# = 0
if sy# 0
if sz# > 0 then angle# = atan(sx#/sz#)
if sz# 0 then angle# = 360 - atan(abs(sx#)/sz#)
if sz# 0 then angle# = 0
if sz# 0
if sy# > 0 then angle# = atan(sx#/sy#)
if sy# 0 then angle# = 360 - atan(abs(sx#)/sy#)
if sy# 0 then angle# = 0
if sy# 0
if distz# > 0 then angle# = atan(distz#/disty#)
if distz# 0 then angle# = 180 - atan(distz#/abs(disty#))
if distz# 0 then angle# = 0
if distz# 0
if distz# > 0 then angle# = atan(distx#/distz#)
if distz# 0 then angle# = 360 - atan(abs(distx#)/distz#)
if distz# 0 then angle# = 0
if distz# 0
if disty# > 0 then angle# = atan(distx#/disty#)
if disty# 0 then angle# = 360 - atan(abs(distx#)/disty#)
if disty# 0 then angle# = 0
if disty#
Bu$herie
How many civilians is he going to kill ? he's going to burn in hell, and I hope that his pain will make him inderstand !