Save list of sprite physics joints

This commit is contained in:
Viktor Lidholt
2015-10-12 16:53:24 -07:00
parent 13ade2c732
commit 2d2b4a8a58
2 changed files with 4 additions and 0 deletions

View File

@@ -25,6 +25,7 @@ abstract class PhysicsJoint {
if (_joint == null) {
_physicsNode = physicsNode;
_joint = _createB2Joint(physicsNode);
_physicsNode._joints.add(this);
}
}
@@ -32,6 +33,7 @@ abstract class PhysicsJoint {
if (_joint != null && _active) {
_physicsNode.b2World.destroyJoint(_joint);
_joint = null;
_physicsNode._joints.remove(this);
}
_active = false;
}

View File

@@ -31,6 +31,8 @@ class PhysicsNode extends Node {
_ContactHandler _contactHandler;
List<PhysicsJoint> _joints = [];
List<box2d.Body> _bodiesScheduledForDestruction = [];
double b2WorldToNodeConversionFactor = 10.0;