It seems to be that the wheels have no grip with the ground, and wont cause the car to move at all... I followed the tutorial in the reference section of dark physics and to no success.
I think from what someone has told me the centre of rotation is off, but it should still give some movement to the car right?
Anyway heres the .zip if anyone wanted to poked around with it.
http://NarcoticRacing.com/test.zip (6 1/2 mbs.)
And heres the code.
phy start
autocam on
sync on
sync rate 60
color backdrop rgb(130,160,220)
position camera -5, 4, -7.5
rotate camera 0,30,0
make light 1
set directional light 1, -5, -5, 5
Global VehicleId as Integer
Global WheelId as Integer
make object terrain 1 ` create the terrain object
set terrain heightmap 1, "map.bmp" ` set the heightmap
set terrain scale 1, 12, 0.6, 12 ` set the scale
set terrain split 1, 4 ` split value by 16 * 16
set terrain tiling 1, 1 ` detail map tiling
set terrain light 1, 1, -0.25, 0, 1, 1, 0.78, 0.5 ` light - xdir, ydir, zdir, red, green, blue, intensity
set terrain texture 1, 101, 102 ` base and detail texture
build terrain 1 ` finally build the terrain
phy make rigid body static terrain 1
CreateVehicle("car.X", "Wheel.X")
` main loop
do
`gosub driveCar
perform checklist for object limbs VehicleId
for n = 1 to checklist quantity()
text 0,n*10,checklist string$(n)
text 150,n*10 , str$(checklist value a(n))
next n
` follow car
`set camera to follow object position x ( VehicleId ), object position y ( VehicleId ), object position z ( VehicleId ), 0, 6, 4, 1, 0
position camera object position x ( VehicleId ), object position y ( VehicleId ), object position z ( VehicleId )-40
` update physics and screen
phy update
sync
loop
Remstart
driveCar:
if upkey ( ) = 1
phy set vehicle motor force VehicleId, phy get vehicle motor force ( VehicleId )
else
if downkey ( ) = 1
phy set vehicle motor force VehicleId, 0.0
else
if phy get vehicle motor force ( VehicleId ) <> 0.0
phy set vehicle motor force VehicleId, 0.0
endif
endif
endif
steeringAngle# = phy get vehicle steering angle ( VehicleId )
steeringDelta# = phy get vehicle steering delta ( VehicleId )
if leftkey ( ) = 1
if steeringAngle# > ( -1.0 + steeringDelta# )
steeringAngle# = steeringAngle# - (steeringDelta# / 2)
endif
else
if rightkey ( ) = 1 AND steeringAngle# < ( 1.0 - steeringDelta# )
if steeringAngle# < ( 1.0 - steeringDelta# )
steeringAngle# = steeringAngle# + (steeringDelta# / 2)
endif
else
if steeringAngle# > 0.0
steeringAngle# = steeringAngle# - steeringDelta# * 2
if steeringAngle# < 0
steeringAngle# = 0.0
endif
else
if steeringAngle < 0.0
steeringAngle# = steeringAngle# + steeringDelta# * 2
if steeringAngle# > 0
steeringAngle# = 0.0
endif
Endif
Endif
Endif
Endif
phy set vehicle steering angle VehicleId, steeringAngle#
RETURN
remend
Function CreateVehicle(BodyFile as String,WheelFile as String)
VehicleId = FreeObj()
Load object BodyFile, VehicleId
Position object VehicleId, 220, 200, 300
`phy make rigid body dynamic mesh VehicleId, "Carfile.dpmesh"
`phy load rigid body dynamic mesh VehicleId, "Carfile.dpmesh
`WheelId = FreeObj()
`Load Object WheelFile, WheelId
set blend mapping on VehicleId,1,3,2,16
`Load object WheelFile + ".x", WheelId
phy create vehicle VehicleId
phy add vehicle body VehicleId, object size x(VehicleId), object size y(VehicleId)-2.5, object size z(VehicleId), 0, 0, 0
`FrontWheels
phy add vehicle wheel VehicleId, 23, -1.5, 0.3, 1.1, 0.75, 0.2, 1, 1`left front
phy add vehicle wheel VehicleId, 3, 1.5, 0.3, 1.1, 0.75, 0.2, 0, 0`left rear
`RearWheels
phy add vehicle wheel VehicleId, 15, -1.5, 0.3, -1.1, 0.75, 0.2, 1, 1`right front
phy add vehicle wheel VehicleId, 9, 1.5, 0.3, -1.1, 0.75, 0.2, 0, 0`right rear
rotate limb VehicleId, 15, 0, 90, 90
`Motor Force
phy set vehicle max motor VehicleId, 300.0
`Steering ability
phy set vehicle steering delta VehicleId, 0.1
`Max Steer Angle
phy set vehicle max steering angle VehicleId, 0.4
`Setup Controls Automaticalling
phy set vehicle auto VehicleId, 1
`Setup Vehicle Suspension
phy set vehicle suspension spring VehicleId,100
`Set the mass
phy set vehicle mass VehicleId, 1000
`Set the Friction
phy set vehicle dynamic friction VehicleId, .2
`Which wheels to use
phy set vehicle wheel power VehicleId, 1, 0 `Front wheel drive.
`Finished, now build our monster! Muahaha!
phy build vehicle VehicleId
EndFunction VehicleId
function FreeObj()
repeat
inc o
until object exist(o) = 0
endfunction o