I'm using a limb and raycasting in my FPS for bullet collision, but when I walk downhill on my matrix, the limb doesn't go down either. I'm using DBP. Here's an example of the problem I'm having:
REM Project: FPS
`Setup game
flush video memory
set display mode 1440,900,32
hide mouse
sync on
sync rate 80
`Create player
playerObj=1
playerSpeed#=0.18
playerRunSpeed#=0.45
playerHP=100
make object sphere playerObj,5
position object playerObj,5,2.5,5
`hide object playerObj
`Create limb for bullet path
make object sphere 9999,10
make mesh from object 1,9999
delete object 9999
add limb playerObj,1,1
offset limb playerObj,1,0,0,100
`hide limb 1,1
`Matrix
mapsize=1000
mapsegments=80
make matrix 1,mapsize,mapsize,mapsegments,mapsegments
randomize matrix 1,4
`Custom matrix
set matrix height 1,14,14,-10
set matrix height 1,15,15,-4
set matrix height 1,14,15,-8
set matrix height 1,15,14,-10
set matrix height 1,7,7,-12.1
set matrix height 1,7,8,-12.1
set matrix height 1,8,7,-12.1
set matrix height 1,8,8,-12.1
set matrix height 1,8,9,-12.1
set matrix height 1,9,9,-12.1
set matrix height 1,9,8,-12.1
set matrix height 1,7,9,-12.1
set matrix height 1,9,7,-12.1
set matrix height 1,10,9,-12.1
set matrix height 1,9,10,-12.1
set matrix height 1,8,10,-12.1
set matrix height 1,10,8,-12.1
set matrix height 1,10,7,-12.1
set matrix height 1,7,10,-12.1
set matrix height 1,10,10,-12.1
update matrix 1
`Main loop
do
`Crosshair
ink rgb(255,0,0),0
circle (screen width()/2)-4,(screen height()/2)-4,8
dot (screen width()/2)-4,(screen height()/2)-4
`Set player positions before moving
oX#=object position X(playerObj)
oY#=get ground height(1,X#,Z#)+5
oZ#=object position Z(playerObj)
`Controls
if (keystate(17)=1 or upkey()=1) `Up key / W Key
if (shiftkey()=1)
move object playerobj,playerRunSpeed# `Run forward
else
move object playerObj,playerSpeed# `Walk forward
endif
endif
if (keystate(31)=1 or downkey()=1) `Down key / S Key
move object playerObj,-playerSpeed# `Walk backward
endif
if (keystate(30)=1 or leftkey()=1) `Left key / A Key
move object left playerObj,playerSpeed# `Strafe left
endif
if (keystate(32)=1 or rightkey()=1) `Right key / D Key
move object right playerObj,playerSpeed# `Strafe right
endif
`Set player position after moving
X#=object position X(playerObj)
Y#=get ground height(1,X#,Z#)+5
Z#=object position Z(playerObj)
`Camera
position camera X#,Y#,Z#
oldcAY# = cAY#
oldcAX# = cAX#
cAY# = WrapValue(cAY#+MousemoveX()*0.2)
cAX# = WrapValue(cAX#+MousemoveY()*0.2)
caZ# = Camera angle Z()
cTestX#=WrapValue(cAX#-180)
if (cTestX# > 235) then cAX#=55
if (cTestX# < 105) then cAX#=285
yrotate camera curveangle(cAY#,oldcAY#,24)
xrotate camera curveangle(cAX#,oldcAX#,24)
yrotate object playerObj,camera angle Y(0)
xrotate object playerObj,camera angle X(0)
`Syncronize
sync
loop
I also tried
offset limb 1,1,0,oY#,100
after walking in the main loop and that didn't help. I haven't had much experience with limbs so any help will be appreciated.