Remove duplicate acceleration.
authorJoe Wreschnig <joe.wreschnig@gmail.com>
Thu, 18 Sep 2014 15:53:53 +0000 (17:53 +0200)
committerJoe Wreschnig <joe.wreschnig@gmail.com>
Thu, 18 Sep 2014 15:53:53 +0000 (17:53 +0200)
Remove limits on rotor angles.

src/main.js

index 1846c3e421350df747f929a7dc2dbf4aa5530606..6c1505ddc8447bc1e5dc0661c485e55b0e2bd6d1 100644 (file)
@@ -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])),