I am disappointed in how the texture turned out. I have the car working (to a point) using Scorpyo's code, but if I turn the front wheels while it is moving, they get all messed up. I can turn them while the car is not moving fine. I tried re-rigging the car differently, but no joy.
EDIT: Got it working with Scorpyo's code! (okay, I made a couple of edits). The front wheels turn in the direction the car is moving, as they should. I found that the joints had to all be set at the same exact Y position in order for them to roll and turn properly. I can email you the model if you like, but I would like to work on the texture some more.
Post Edit:
Here is Scorpyo's code revised to work with the model.
top:
Rem * Title : Scorpyo
Rem * Author : July2002
Rem a few alterations by LBFN on 5 June 2012
rem ********** MAIN 1 ****************
set display mode 1032,768,32
hide mouse
sync on
autocam off
backdrop off
set global collision off
sync rate 60
grid=40
landsize=40000
mtxrandomize=1
skysphere=40000
gosub Setupland1
rem gosub morematrices
gosub makesky
gosub setambient
gosub Vars1
gosub loadtscar
gosub Resetcam
camrot=30
rem set normalization on
rem *****MAIN LOOP******
top2:
do
keypress=scancode()
if inkey$()="e" then sync rate 0
if inkey$()="E" then sync rate 60
rem check borders
gosub checkborders
gosub Playercontrol
gosub printdata
rem Calculate position data
oldx#=x#
oldz#=z#
x#=newxvalue(x#,a#,s#)
z#=newzvalue(z#,a#,s#)
rem calls camera update subroutine
gosub update_camera
h#=get ground height(1,x#,z#)
rem position object 9999,x#,h#+5,z#
rem yrotate object 9999,a#
position object 2,x#,h#+1,z#
yrotate object 2,a#
rem Sky follows active character
position object 9990,x#,0,z#
rem Update screen
sync
rem End loop
loop
rem ** SUBROUTINES ***************************
rem ****** CREATE LEVEL ******
Setupland1:
rem Load and create images
rem ground textures
load image "textures\land256.bmp",4
rem Make landscape
if grid>200 then grid=200
make matrix 1,landsize,landsize,grid,grid
rem set matrix 1,1,0,0,1,1,1,1
prepare matrix texture 1,4,1,1
randomize matrix 1,mtxrandomize
rem get ground done
update matrix 1
return
setambient:
set ambient light 80
if fog available()=1
fog on
fog distance 80000
fog color rgb(150,150,200)
endif
return
rem Create Sky
makesky:
rem sky texture
load image "textures\skytext.bmp",1
make object sphere 9990,skysphere
set object 9990,1,0,0,1,1,1,1
texture object 9990,1
return
loadtscar:
load object "tscar\tscar.x",2
yrotate object 2,180.0
fix object pivot 2
position object 2,20000,0,1100
set object 2,1,1,0,1,0,1,1
set object specular 2,0
set object diffuse 2,30
return
rem ****VARS1****
Vars1:
rem **Player Start position**
x#=20000
z#=1000
return
rem ***** PLAYERCONTROL *****
Playercontrol:
if upkey()=1 and s#<12 then s#=s#+0.2
if downkey()=1 and s#>-12 then s#=s#-0.2
if s#>0 or s#<0 then limbrot#=wrapvalue(limbrot#+(2.4*(s#)))
if s#>0 and turn#>0 then a#=wrapvalue(a#+(s#/10*abs(turn#/20)))
if s#>0 and turn#<0 then a#=wrapvalue(a#-(s#/10*abs(turn#/20)))
if s#<0 and turn#<0 then a#=wrapvalue(a#-(s#/10*abs(turn#/20)))
if s#<0 and turn#>0 then a#=wrapvalue(a#+(s#/10*abs(turn#/20)))
if leftkey()=1 and turn#>-30 then turn#=(turn#-0.8)
if rightkey()=1 and turn#<30 then turn#=(turn#+0.8)
if leftkey()=0 and rightkey()=0 and turn#>-1.0 and turn#<1.0 then turn#=0.0
rotate limb 2,4,-limbrot#,turn#,0 : //Pass Front
rotate limb 2,5,-limbrot#,turn#,0 : // driver front
rotate limb 2,6,-limbrot#,0,0 : // driver rear
rotate limb 2,7,-limbrot#,0,0 : // pass rear
if inkey$()="-" then s#=0.0
if inkey$()="ù" then s#=60.0
return
update_camera:
if keypress=86 and resetflag=0 then gosub Resetcam:resetflag=1:keypress=0:wait 100
if keypress=44 and rotflag=0 then camrot=180:rotflag=1:keypress=0:wait 100
if keypress=44 and rotflag=1 then camrot=0:rotflag=0:keypress=0:wait 100
if keypress=47 then cax#=wrapvalue(cax#+1.0):xrotate camera cax#:keypress=0
if keypress=48 then cax#=wrapvalue(cax#-1.0):xrotate camera cax#:keypress=0
if keypress=49 then camrot=camrot-4:keypress=0
if keypress=50 then camrot=camrot+4:keypress=0
rem
mymousex=mousemovex()
if mymousex>0 then camrot=camrot+1
if mymousex<0 then camrot=camrot-1
mymousez=mousemovez()
if mymousez>0 then camdist=camdist+20:camhgt=camhgt-10
if mymousez<0 then camdist=camdist-20:camhgt=camhgt+10
cx#=newxvalue(x#,a#+camrot,camdist)
cz#=newzvalue(z#,a#+camrot,camdist)
cy#=h#
position camera cx#,cy#+camhgt,cz# : // take this out
rem point camera x#,h#+camhgt,z#
yrotate camera a#+camrot
xrotate camera cax#
return
rem camera reset
Resetcam:
set camera range 10,50000
camfollow=1
camdist=-200
camhgt=80
camrot=0
cax#=0.0
xrotate camera cax#
return
printdata:
set cursor 0,0
set text opaque
rem debug check
print "polygons=",statistic(1)
print "Fps=",screen fps()
print "landsize=",landsize
print "grid=",grid
print "x#=",x#
print "z#=",z#
print "h#=",h#
print "a#=",a#
print "s#=",s#
print "limbrot#=",limbrot#
print "turn#=",turn#
print
print "Drive with arrow keys"
return
checkborders:
if x#<100 then x#=100
if x#>landsize-100 then x#=landsize-100
if z#<100 then z#=100
if z#>landsize-100 then z#=landsize-100
return
end
So many games to code.......so little time.