No answers yet
I really cant find out how this should be done. Ive read the documentation, tried to copy the binary moon hover racing tutorial. Nothing seems to work. Ive also read all the post in the forum concerning 3d models and glueing, searched for them.
This is the code snippet as it is now:
rem make temp player character
make object cube 1,10
position object 1,2500,100,2500
load object "rhino.3ds",2
position object 2,2600,100,2600
size=30
scale object 2,size,size,size
rem glue object to limb 2,1,0
It works just fine as it is, the model sits there besides nice and quietly. But _as soon_ as I un-rem the glue object part it wont run! Please help me out.
If you want to see the whole code, here it is:
Rem Project: hydralisk
Rem Created: 2004-05-30 00:47:47
Rem ***** Main Source File *****
rem setup
sync on
sync rate 30
rem set window on
rem set window position 150,75
autocam off
rem variables
worldsize=5000
turnspeed#=3.0
speed#=5.0
rem make matrix
make matrix 1,worldsize,worldsize,50,50
load image "grass.bmp",1
prepare matrix texture 1,1,1,1
fill matrix 1,0,1
randomize matrix 1,100
update matrix 1
rem make fog
fog on
backdrop on
set camera range 1,2500
fog distance 1500
fog color RGB(192,192,192)
color backdrop RGB(0,128,255)
rem make temp player character
make object cube 1,10
position object 1,2500,100,2500
load object "rhino.3ds",2
position object 2,2600,100,2600
size=30
scale object 2,size,size,size
rem glue object to limb 2,1,0
playerX#=object position x(1)
playerZ#=object position z(1)
playerY#=get ground height(1,playerX#,playerZ#)
rem MAIN LOOP
DO
gosub move
gosub tilt
rem refresh screen
sync
LOOP
move:
rem store player heading
playerA#=object angle Y(1)
rem sort out movement and check for falloff
if upkey()=1 or downkey()=1
testX#=newxvalue(playerX#, playerA#, 30)
testZ#=newzvalue(playerZ#, playerA#, 30)
if testX#<worldsize and testX#>0 and testZ#<worldsize and testZ#>0
if upkey()=1 then move object 1,speed#
if downkey()=1 then move object 1,-speed#
endif
endif
rem turn it
if rightkey()=1 then playerA#=playerA#+turnspeed#
if leftkey()=1 then playerA#=playerA#-turnspeed#
rem get the new position
playerX#=object position x(1)
playerZ#=object position z(1)
playerY#=get ground height(1,playerX#,playerZ#)
rem and place it there, increase the Y coord so it isnt half burried
position object 1,playerX#,playerY#+5.0,playerZ#
rem place the camera according to the players position
camX#=newxvalue(playerX#,playerA#-180,100)
camZ#=newzvalue(playerZ#,playerA#-180,100)
camY#=get ground height(1,camX#,camZ#)
rem do the actual placement
position camera camX#,camY#+50,camZ#
point camera playerX#,playerY#+25,playerZ#
return
tilt:
rem how for around the vehicle to check
checkrange=1
rem check the height in a square around the vehicle
a#=playerA#
frontX#=newxvalue(playerX#,a#,checkrange)
frontZ#=newzvalue(playerZ#,a#,checkrange)
a#=playerA#+180
backX#=newxvalue(playerX#,a#,checkrange)
backZ#=newzvalue(playerZ#,a#,checkrange)
a#=playerA#+90
leftX#=newxvalue(playerX#,a#,checkrange)
leftZ#=newzvalue(playerZ#,a#,checkrange)
a#=playerA#-90
rightX#=newxvalue(playerX#,a#,checkrange)
rightZ#=newzvalue(playerZ#,a#,checkrange)
rem work out the tilt value based on the heights gotten above
frontheight#=get ground height(1,frontX#,frontZ#)
backheight#=get ground height(1,backX#,backZ#)
leftheight#=get ground height(1,leftX#,leftZ#)
rightheight#=get ground height(1,rightX#,rightZ#)
rem work out how much to tilt the vehicle
xA#=wrapvalue((backHeight#-frontHeight#)*20)
zA#=wrapvalue((leftHeight#-rightHeight#)*20)
rem smooth it a bit
xA#=curveangle((backHeight#-frontHeight#)*30,object angle x(1),5)
zA#=curveangle((leftHeight#-rightHeight#)*30,object angle z(1),5)
rem ...and tilt it!
rotate object 1,xA#,playerA#,zA#
return
But please, please, pleasy... with sugar on top
I would reaaally like to get this done. Been trying for quite a few hours now :S
Thanks in advance!
Mizi
Dreaming of creating a highly advanced AI mind