- joint
- The MonoTouch.SpriteKit.SKPhysicsJoint to be added.
The MonoTouch.SpriteKit.SKNodes whose MonoTouch.SpriteKite.SKNode.PhysicsBodys are associated with the joint must be added to the MonoTouch.SpriteKit.SKScene before calling this method, or a segfault will result. The following example demonstrates the necessary order:
C# Example
var joint = SKPhysicsJointFixed.Create(node1.PhysicsBody, node1.PhysicsBody, node1.Position);
//mySkScene.PhysicsWorld.AddJoint(joint); //NO. This will segfault if node1 or node2 not in mySkScene
mySkScene.AddChild(node1);
mySkScene.AddChild(node2);
mySkScene.PhysicsWorld.AddJoint(joint); //This works