Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- bmwM3.js.old 2012-11-17 21:20:42.438109157 +0100
- +++ bmwM3.js 2012-11-17 21:25:43.651911123 +0100
- @@ -51,9 +51,10 @@ function init_chassis(){
- this.finalRatio = 3;
- this.torqueMultiplier = 10;
- + this.maximumSpeed = -1; // speed in m/s. a value < 0 means there's no maximum speed
- //end of engine properties
- -
- - this.torque = engineTorque;
- +
- + this.torque = engineTorque;
- return {mass:1500, steering:2.0, steering_ecf:60, centering: 2.6, centering_ecf:20};
- }
- @@ -119,9 +120,9 @@ function update_frame(dt, engine, brake,
- steering *= 0.6;
- this.steer(-2, steering);
- -
- - var khm = Math.abs(this.speed()) * 3.6;
- - var wheels = Math.abs(this.speed()) / (this.wheelRadius * (2 * Math.PI));
- + var absSpeed = Math.abs(this.speed());
- + var khm = absSpeed * 3.6;
- + var wheels = absSpeed / (this.wheelRadius * (2 * Math.PI));
- var gears;
- if (this.speed() >= 0) {
- @@ -140,7 +141,10 @@ function update_frame(dt, engine, brake,
- this.gear -= 1;
- }
- - var force = engine * this.torque(rpm) * this.torqueMultiplier;
- + var force = 0;
- + if (this.maximumSpeed < 0 || absSpeed < this.maximumSpeed) {
- + force = engine * this.torque(rpm) * this.torqueMultiplier;
- + }
- this.wheel_force(2, force);
- this.wheel_force(3, force);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement