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

10 years ago by AndrewMast

I am using the plugin from demo on this page.

Entities, collision, etc work fine. Except for the joints.

I run the following code and it produces an error.

Code: (Btw, the bodies aren&039;t #undefined. I've checked that.)
var jointDef = new Box2D.Dynamics.Joints.b2JointDef();
jointDef.bodyA = entity1.body;
jointDef.bodyB = entity2.body;
jointDef.collideConnected = false;

var joint = ig.world.CreateJoint(jointDef);

Error:
[Error] TypeError: null is not an object (evaluating 'c.m_prev=null') - CreateJoint - lib.js

The line of code (causing the error in lib.js):
...CreateJoint=function(a){var c=q.Create(a,null);c.m_prev=null;if(c.m_next=this.m_jointList)...

10 years ago by Joncom

Perhaps instead of:
var joint = new Box2D.Dynamics.Joints.b2JointDef();

you meant:
var jointDef = new Box2D.Dynamics.Joints.b2JointDef();

10 years ago by AndrewMast

Nope. I forgot to re-name that when putting it in the forum. (And I have tried renaming it in the code too)

10 years ago by Joncom

What line in "lib.js" is that error occurring on?

10 years ago by AndrewMast

(I added this when I made my other reply)

The line of code (causing the error in lib.js):
...CreateJoint=function(a){var c=q.Create(a,null);c.m_prev=null;if(c.m_next=this.m_jointList)...
Page 1 of 1
« first « previous next › last »