Hey I have been having trouble with my collision with platforms. I want there to be raised platforms that the ball you control can jump on.
The problem is that when I jump onto a box the ball gets stuck onto the object and slowly sinks into it. What I think is going on is that the ball can only function when it meets the ground height, or it’s a collision problem, anyway I’ve gotten lost I would really would appreciate some help =] thanks
sync rate 60 ; hide mouse ; autocam off
make matrix 1,200,200,1,1
load image "cave.bmp",1
load image "lava.bmp",2
load image "metal.bmp",3
prepare matrix texture 1,2,1,1
position matrix 1,0,0,0
update matrix 1
make object sphere 1,1
texture object 1,3
rotate object 1,0,0,0
fix object pivot 1
point object 1,0,0,0
make object box 2,200,100,0.5
make object box 3,200,100,0.5
make object box 4,0.5,100,200
make object box 5,0.5,100,200
make object box 6,200,0.5,200
make object box 7,10,9,10
set object collision to boxes 1
g# = 0
speed# = 0
gravity# = 0
jumpower# = 0
onground = 0
y# = 0
x# = 0
z# = 0
position object 1,150,1,100
position object 2,100,45,200
position object 3,100,45,0
position object 4,0,45,100
position object 5,200,45,100
position object 6,100,68,100
position object 7,100,20,50
texture object 2,1
texture object 3,1
texture object 4,1
texture object 5,1
texture object 6,1
automatic object collision 1,0,0
automatic object collision 2,0,0
automatic object collision 3,0,0
automatic object collision 4,0,0
automatic object collision 5,0,0
automatic object collision 6,0,0
automatic object collision 7,0,0
make light 1
color light 1,512,100,100
position light 1,100,100,100
set light range 1,500
do
x# = object position x(1)
y# = object position y(1)
z# = object position z(1)
a# = object angle y(1)
if upkey()=1
xrotate object 1,wrapvalue(object angle x(1)+6)
speed# = speed# + 0.15
else
if onground = 1 then speed# = speed# -0.15
if speed# < 0 then speed# = 0
endif
x# = newxvalue (x#,a#,speed#/10)
z# = newzvalue (z#,a#,speed#/10)
if downkey()=1
xrotate object 1,wrapvalue(object angle x(1)-6)
x# = newxvalue (x#,a#,-.2)
z# = newzvalue (z#,a#,-.2)
endif
if rightkey()=1 then yrotate object 1, wrapvalue (object angle y(1)+2)
if leftkey()=1 then yrotate object 1, wrapvalue (object angle y(1)-2)
if spacekey()=1 and onground = 1 then jumpower# = 0.3
if jumpower#>0 then jumpower# = jumpower#-.002
y# = y#+jumpower#
g# = get ground height (1,x#,y#)
if y#>g#
gravity#=gravity#+0.005
y#=y#-gravity#
onground=0
else
y#=g#
gravity#=0
onground=1
endif
if speed# > 6 then speed# = 6
position object 1,x#,y#,z#
set camera to follow x#,y#,z#,a#,10,3,20,0
loop