ok thanks cameni!
right well i got the suspension sorted so the wheel dont drop 2 foot when it jumps! still done feel right though, will have to keep playing with damping a bit. the car sits on the ground nice now but i cant seem to stop it driving like its on ice? nothing i change makes a difference! gonna need a little help there!
anyway gonna keep going and see what happens! heres the js file as it is now but like i said, its like driving on ice!
function init_chassis()
{
var wheelparam = {
radius: 0.26,
width: 0.2,
suspension_max: 0.02,
suspension_min: -0.16,
suspension_stiffness: 4.0,
damping_compression: 0.4,
damping_relaxation: 0.14,
slip: 0.8,
roll_influence: 0.1
};
this.add_wheel('wheel_FR',wheelparam);
this.add_wheel('wheel_FL',wheelparam);
this.add_wheel('wheel_RR',wheelparam);
this.add_wheel('wheel_RL',wheelparam);
return {mass:1170, steering:1.0, steering_ecf:10000, centering: 0.6, centering_ecf: 10, com:{y:-0.9, x:-1.8, z:0.0}};
}
//invoked for each new instance of the vehicle
function init_vehicle(){
this.set_fps_camera_pos({y:-1.4, x:-2, z:2.7});
}
//invoked when engine starts or stops
function engine(start){
}
const EF = 27000.0;
const BF = 28000.0;
const maxkmh = 243;
const forceloss = EF / (0.2*maxkmh + 1);
//invoked each frame to handle the inputs and animate the model
function update_frame(dt, engine, brake, steering)
{
var kmh = this.speed()*3.6;
var redux = engine>=0 ? 0.2 : 0.6;
var esign = engine<0 ? -1 : 1;
engine = EF*Math.abs(engine);
var force = (esign>0) == (kmh>=0)
? engine/(redux*Math.abs(kmh) + 1)
: engine;
force -= forceloss;
force = Math.max(0.0, Math.min(force, engine));
engine = esign*force;
steering *=0.6;
brake *= BF;
this.steer(-2, steering);
this.wheel_force(-1, engine);
this.wheel_brake(-1, brake);
this.animate_wheels();
}