Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Koen

When I try to create a b2.RevoluteJoint, I get the following error:
Error: this.__varz is not a function
Source file: http://xxxxxxxx/impact/lib/plugins/box2d/lib.js
Line: 290

Is this a bug in the ported box2d version or am I doing something wrong?

My code looks roughly like this:

var motorDefinition = new b2.RevoluteJointDef();
motorDefinition.Initialize(ig.world.GetGroundBody(), this.body, new b2.Vec2((this.pos.x + this.size.y / 2) * b2.SCALE, (this.pos.y + this.size.y / 2) * b2.SCALE));
motorDefinition.lowerAngle = -20 * Math.PI;
motorDefinition.upperAngle = 0.0 * Math.PI;
motorDefinition.enableLimit = true;
motorDefinition.motorSpeed = 0.0;

var motor = b2.RevoluteJoint(ig.world.CreateJoint(motorDefinition));

Thanks in advance,

Koen

1 decade ago by Koen

Solved it, the problem was I was porting my code from AS3 where I casted to b2RevoluteJoint. The last line should just be:
var motor = ig.world.CreateJoint(motorDefinition);

1 decade ago by MobileMark

I'm glad you figured it out! I was playing around with it a little but I got nowhere :/

Would you mind sharing the basic layout of the Entity's code? I'd love to know how to make a joint in Box2D but so far i'm striking out.

Thanks!
Page 1 of 1
« first « previous next › last »