From: Joe Wreschnig Date: Tue, 9 Sep 2014 22:41:03 +0000 (+0200) Subject: Tweaks to friction constants. X-Git-Url: https://git.yukkurigames.com/?a=commitdiff_plain;h=7f19eb4b8237b305b3d315a137c89a706011b3e4;p=featherfall2.git Tweaks to friction constants. Falling anti-rotation correction. --- 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;