From 4fb058ae60803e81e9ea211b7af2a540695a7b72 Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Thu, 18 Sep 2014 17:53:53 +0200 Subject: [PATCH] Remove duplicate acceleration. Remove limits on rotor angles. --- src/main.js | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/main.js b/src/main.js index 1846c3e..6c1505d 100644 --- a/src/main.js +++ b/src/main.js @@ -113,7 +113,7 @@ var PlayerController = yT(yuu.C, { tick: function () { this._updatePivots(); - var THRUST = 5; + var THRUST = 3.5; /* var DRAG_FREE = 0.01; var DRAG_OPEN = 0.5; var DRAG_LOCK = 1; @@ -129,14 +129,6 @@ var PlayerController = yT(yuu.C, { this.body.body.ApplyForceToCenter(leftThrust); this.body.body.ApplyForceToCenter(rightThrust); - var cleft = Math.cos(leftAngle); - var cright = Math.cos(rightAngle); - var sleft = Math.sin(leftAngle); - var sright = Math.sin(rightAngle); - - var ax = thrust * (cleft - cright); - var ay = thrust * (sright + sleft); - /* var v = this.body.linearVelocity; var drag = this.up ? DRAG_OPEN : this.free ? DRAG_FREE : DRAG_LOCK; @@ -147,8 +139,6 @@ var PlayerController = yT(yuu.C, { ax += CORRECTION * (cleft - cright) * v.y * v.y * Math.sign(v.y); */ - this.body.ApplyForce(new b2Vec2(ax, ay), this.body.position); - this._updateTransforms(); }, @@ -185,7 +175,6 @@ function pinJoint (world, bodyA, bodyB, anchor) { dfn.maxMotorTorque = 100.0; dfn.motorSpeed = 0.1; dfn.enableMotor = true; - dfn.enableLimit = true; return Box2D.castObject(world.CreateJoint(dfn), Box2D.b2RevoluteJoint); } @@ -224,8 +213,6 @@ var GameScene = yT(yuu.Scene, { var rightJoint = pinJoint(world, right.body, body.body, [0.1, 5.15]); this.player.addChildren(leftWing, rightWing); this.entity0.addChild(this.player); - leftJoint.SetLimits(0, Math.PI / 2); - rightJoint.SetLimits(-Math.PI / 2, 0); var ground = new yuu.E( new BodyC(bodyFromLine(world, [-100, 0], [100, 0])), -- 2.30.2