i want that the sphere is going up against the rotated box, but it stops when it hits the box, how can i make this right?
here is the code:
make object sphere 1,50
make object box 11,1000,10,1000
position object 11,0,-30,0
make object box 12,200,100,200
xrotate object 12,20
position object 12,200,-40,200
sync on
for i = 1 to 200
if object exist(i)=1
set object collision to polygons i
endif
next i
do
sync
movement
loop
function movement
`move forward
if upkey()=1
oldx#=x#
x#=inc_x_pos(x#,yang#,3.0)
position object 1,x#,y#,z#
if object collision(1,hitnr)>0
x#=oldx#
endif
oldz#=z#
z#=inc_z_pos(z#,yang#,3.0)
position object 1,x#,y#,z#
if object collision(1,hitnr)>0
z#=oldz#
endif
endif
`move backward
if downkey()=1
oldx#=x#
x#=inc_x_pos(x#,yang#,-3.0)
position object 1,x#,y#,z#
if object collision(1,hitnr)>0
x#=oldx#
endif
oldz#=z#
z#=inc_z_pos(z#,yang#,-3.0)
position object 1,x#,y#,z#
if object collision(1,hitnr)>0
z#=oldz#
endif
endif
`the turning
if leftkey()=1
yang#=wrapvalue(yang#-3)
yrotate object 1,yang#
endif
if rightkey()=1
yang#=wrapvalue(yang#+3)
yrotate object 1,yang#
endif
`jumping
if spacekey()=1 and playergrav#=0 then playergrav#=4.0
playergrav#=playergrav#-0.2
oldy#=y#
y#=y#+playergrav#
if y#=oldy# then goto noycol
position object 1,x#,y#,z#
if object collision(1,hitnr)>0
y#=oldy#
playergrav#=0
endif
noycol:
camera(x#,y#,z#,yang#)
endfunction
function camera(x#,y#,z#,yang#)
set camera to follow x#,y#,z#,yang#,300,50,5,5
point camera x#,y#,z#
endfunction
function inc_x_pos(currentx#,angle#,value#)
currentx#=newxvalue(currentx#,angle#,value#)
endfunction currentx#
function inc_z_pos(currentz#,angle#,value#)
currentz#=newzvalue(currentz#,angle#,value#)
endfunction currentz#
if I = 1 then I = 1 else I = 0