From 7f19eb4b8237b305b3d315a137c89a706011b3e4 Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Wed, 10 Sep 2014 00:41:03 +0200 Subject: [PATCH] Tweaks to friction constants. Falling anti-rotation correction. --- src/main.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.js b/src/main.js index d252c74..4f888ba 100644 --- a/src/main.js +++ b/src/main.js @@ -44,11 +44,12 @@ var PlayerController = new yT(yuu.C, { this._updatePivots(); var GRAVITY = -0.0004; var THRUST = 0.00035; - var FRICTIONK = 0.6; - var FRICTIONS = 2.0; + var FRICTIONK = 3.5; + var FRICTIONS = 5.0; var DRAG_FREE = 0.01; var DRAG_OPEN = 5.0; var DRAG_LOCK = 10.0; + var CORRECTION = 3.0; var leftAngle = (1 - this.leftPivot) * Math.PI / 2; var rightAngle = (1 - this.rightPivot) * Math.PI / 2; @@ -72,6 +73,9 @@ var PlayerController = new yT(yuu.C, { ax += drag * Math.max(cleft, cright) * vx * vx * -Math.sign(vx); ay += drag * (sleft + sright) * vy * vy * -Math.sign(vy); + if (!this.up || this.free) + ax += CORRECTION * (cleft - cright) * vy * vy * Math.sign(vy); + var origX = this.x; var origY = this.y; this.y += vy + ay; -- 2.30.2