I found by replacing MoveVehicle(vehicle ref as vehicle, env as environment) with
this one its slightly more controllable as just tapping left for example only steers a little to left
//
// This moves the vehicle
//
function MoveVehicle(vehicle ref as vehicle, env as environment)
t as point
i as integer
v as float
d as integer
global turn as float
a as float
l as point
dot as float
if vehicle.delay.count > timer()
SetObjectColor(vehicle.chassis, 0, 0xff, 0xff, 0xff)
exitfunction
endif
SetObjectColor(vehicle.chassis, 0xff, 0xff, 0xff, 0xff)
//turn = 0
//if isMobile=FALSE
if GetRawKeyState(KEY_RIGHT) = 1 or GetVirtualButtonState(rightBTN)=1 // Turn right/left
//turn = vehicle.velocity.angularUnit
turn=turn+.025
if turn>2 then turn =2
elseif GetRawKeyState(KEY_LEFT) = 1 or GetVirtualButtonState(leftBTN)=1
//turn = -vehicle.velocity.angularUnit
turn=turn-.025
if turn<-2 then turn=-2
else
turn=0
endif
//else
//turn = (GetDirectionX()/10)
//endif
vehicle.wheelAngle = vehicle.wheelAngle * 0.8 // Dampen the wheel angle
for i=0 to vehicle.wheels.length // Check the wheels
inc d, CheckWheels(vehicle, i, env)
next
// If we have less than 3 wheels on the ground then we're in the air
// so turn everything off until we are in contact with the ground again
if d < 3
if GetObject3DPhysicsLinearVelocityY(vehicle.hit) < -(25 * SCALE_3D) // Falling velocity too high, throttle it
a = DistancePoint(CreatePoint(GetObject3DPhysicsLinearVelocityX(vehicle.hit), GetObject3DPhysicsLinearVelocityY(vehicle.hit) * 0.999, GetObject3DPhysicsLinearVelocityZ(vehicle.hit)))
SetObject3DPhysicsLinearVelocity( vehicle.hit, GetObject3DPhysicsLinearVelocityX(vehicle.hit), GetObject3DPhysicsLinearVelocityY(vehicle.hit), GetObject3DPhysicsLinearVelocityZ(vehicle.hit), a * .9)
endif
if vehicle.ground = TRUE // Use colours to see if we are in the air or not
SetObjectColor(vehicle.chassis, 0xff, 0, 0, 0xff)
SetObjectColor(vehicle.hit, 0xff, 0, 0, 0xff)
endif
if vehicle.flying = FALSE // First time in the air damp down velocity
SetObject3DPhysicsDamping( vehicle.hit , 0.5, 0.99 )
endif
vehicle.flying = TRUE
exitfunction
endif
if vehicle.flying = TRUE // Just hit the ground, reset damping
SetObject3DPhysicsDamping( vehicle.hit , 0.2, 0.9 )
endif
vehicle.flying = FALSE
if vehicle.ground = TRUE
SetObjectColor(vehicle.hit, 0, 0xff, 0, 0xff)
SetObjectColor(vehicle.chassis, 0, 0xff, 0, 0xff) // Use colours to reort if we are in the air or not
endif
// Get the linear velocity
l = CreatePoint(GetObject3DPhysicsLinearVelocityX(vehicle.hit), GetObject3DPhysicsLinearVelocityY(vehicle.hit), GetObject3DPhysicsLinearVelocityZ(vehicle.hit))
// Get the angular velocity
a = DistancePoint(CreatePoint(GetObject3DPhysicsAngularVelocityX(vehicle.hit), GetObject3DPhysicsAngularVelocityY(vehicle.hit), GetObject3DPhysicsAngularVelocityZ(vehicle.hit)))
v = 0 // Acceleration
if GetRawKeyState(KEY_DOWN) = 1 or GetVirtualButtonState(reverseBTN)
v = -vehicle.velocity.linearUnit
endif
if GetRawKeyState(KEY_UP) = 1 or GetVirtualButtonState(accelerateBTN)=1
v = vehicle.velocity.linearUnit
setObjectImage(vehicle.chassis,vehicle.image[vehicle.imageNum],0)
else
setObjectImage(vehicle.chassis,vehicle.brakeImage[vehicle.imageNum],0)
endif
if vehicle.brakes = TRUE
v = v * 0.9
//setObjectImage(vehicle.chassis,vehicle.brakeImage[vehicle.imageNum],0)
endif
if vehicle.velocity.current < 0
if abs( vehicle.velocity.current + v ) < ( vehicle.velocity.max * 0.5) // Reverse maximum is
inc vehicle.velocity.current, v
else
vehicle.velocity.current = ( vehicle.velocity.max * -0.5)
endif
else
if abs( vehicle.velocity.current + v ) < vehicle.velocity.max
inc vehicle.velocity.current, v
else
vehicle.velocity.current = vehicle.velocity.max * (vehicle.velocity.current / abs(vehicle.velocity.current))
endif
endif
t = GetVehicleDirectionGround(vehicle) // Get the vector of the vehicle
if CheckWalls(vehicle, env, l) = TRUE
exitfunction
endif
SetVector3(vehicle.vectU, l.x, l.y, l.z) // Get the direction
SetVector3(vehicle.vectV, t.x, t.y, t.z)
dot = Round(GetVector3Dot(vehicle.vectU, vehicle.VectV))
if v <> 0
if vehicle.brakes = FALSE
SetObject3DPhysicsLinearVelocity( vehicle.hit, t.x, t.y, t.z, vehicle.velocity.current)
endif
else
if dot <> 0
vehicle.velocity.current = DistancePoint(l) * (dot / abs(dot))
SetObject3DPhysicsLinearVelocity( vehicle.hit, t.x, t.y, t.z, vehicle.velocity.current)
endif
endif
if abs(vehicle.wheelAngle) < 100 and vehicle.delay.count < timer() // turn the wheels
inc vehicle.wheelAngle, turn
SetObjectRotation(vehicle.wheels[0].pivot, 0, vehicle.wheelAngle, 0)
SetObjectRotation(vehicle.wheels[1].pivot, 0, vehicle.wheelAngle, 0)
endif
// Apply the turning force (Dampening is set in SetupVehicle())
// The reason we're checking velocity is because we want a
// tight turning circle when it's slow and a smooth one
// when it's fast
if turn <> 0 and abs(vehicle.velocity.current) > (1 * SCALE_3d)
if dot < 0
turn = -turn
endif
if dot <> 0
if vehicle.steering = STEERING_GLOBAL
l = GetVehicleTurn(vehicle, turn)
else
l.x = 0 : l.y = turn : l.z = 0
endif
SetObject3DPhysicsAngularVelocity( vehicle.hit, l.x, l.y, l.z, ((vehicle.velocity.max - vehicle.velocity.current) / (0.8 * scale_3d)) + (vehicle.velocity.current ) / (0.75 * scale_3d))
endif
endif
endfunction
fubar