Commit 2d2b4a8a authored by Viktor Lidholt's avatar Viktor Lidholt

Save list of sprite physics joints

parent 13ade2c7
...@@ -25,6 +25,7 @@ abstract class PhysicsJoint { ...@@ -25,6 +25,7 @@ abstract class PhysicsJoint {
if (_joint == null) { if (_joint == null) {
_physicsNode = physicsNode; _physicsNode = physicsNode;
_joint = _createB2Joint(physicsNode); _joint = _createB2Joint(physicsNode);
_physicsNode._joints.add(this);
} }
} }
...@@ -32,6 +33,7 @@ abstract class PhysicsJoint { ...@@ -32,6 +33,7 @@ abstract class PhysicsJoint {
if (_joint != null && _active) { if (_joint != null && _active) {
_physicsNode.b2World.destroyJoint(_joint); _physicsNode.b2World.destroyJoint(_joint);
_joint = null; _joint = null;
_physicsNode._joints.remove(this);
} }
_active = false; _active = false;
} }
......
...@@ -31,6 +31,8 @@ class PhysicsNode extends Node { ...@@ -31,6 +31,8 @@ class PhysicsNode extends Node {
_ContactHandler _contactHandler; _ContactHandler _contactHandler;
List<PhysicsJoint> _joints = [];
List<box2d.Body> _bodiesScheduledForDestruction = []; List<box2d.Body> _bodiesScheduledForDestruction = [];
double b2WorldToNodeConversionFactor = 10.0; double b2WorldToNodeConversionFactor = 10.0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment