Box2D PrismaticJoint

Get help using Construct 2

Post » Thu Nov 14, 2013 1:50 pm

hello i want to make a side way car game but i am struggling with the suspension i want the physics behaviours to feel like the second example at the link below
emanueleferonato DOT com/2009/04/06/two-ways-to-make-box2d-cars/
i downlanded some example and behaviors in tutorial section but no luck until i find out that i need a prismatic joint so i tried to ("hack") the official physics behaviours by adding this code i just figured out:
          var B2PrismaticJointDef = function( bA , bB , anchorA , anchorB , axis) {//me
              this.type = B2Joint.e_revoluteJoint ;
              this.localAnchorA = new B2Vec2() ;
              this.localAnchorB = new B2Vec2() ;
              this.localAxisA   = new B2Vec2();//me
              this.userData = null ;
              if( bA !== undefined ){this.bodyA = bA ;}

              if( bB !== undefined ){this.bodyB = bB ;}

              if( anchorA !== undefined){this.localAnchorA.SetV(anchorA) ;}

              if( anchorB !== undefined){this.localAnchorB.SetV(anchorB) ;}

             if( axis !== undefined ){this.localAxisA.SetV(axis) ;}//me










          B2RevoluteJointDef.prototype.Initialize = function (bA, bB, anchor,axis) {

              this.bodyA = bA;

              this.bodyB = bB;

              this.localAnchorA = this.bodyA.GetLocalPoint(anchor);

              this.localAnchorB = this.bodyB.GetLocalPoint(anchor);

              this.referenceAngle = this.bodyB.GetAngle() -this.bodyA.GetAngle();

              this.localAxisA = this.bodyA.GetLocalAxis(axis);

     Box2D.Dynamics.Joints.b2PrismaticJointDef = b2PrismaticJointDef ;
in runtime.js
"still also need to add some code to the edit.js"

WEL it didnt work what am i doing wrong please help me evry one
ps:excuse my english and thank you in advance tnindie2013-11-14 14:27:27
Posts: 44
Reputation: 668

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 2 guests