- bodyA
- Documentation for this section has not yet been entered.
- bodyB
- Documentation for this section has not yet been entered.
- anchorA
- Documentation for this section has not yet been entered.
- anchorB
- Documentation for this section has not yet been entered.
Documentation for this section has not yet been entered.
The SpriteKit.SKNodes associated with bodyA and bodyB must be added to the SpriteKit.SKScene prior to calling this method or Sprite Kit will crash. The following example demonstrates the proper order:
C# Example
var node1 = CreateNodeSomehow();
var node2 = CreateNodeSomehow();
//var joint = SKPhysicsJointLimit.Create(node1.PhysicsBody, node2.PhysicsBody, node1.Position, node2.Position); //NO. This will crash.
mySkScene.AddChild(node1);
mkSkScene.AddChild(node2);
var joint SKPhysicsJointLimit.Create(node1.PhysicsBody, node2.PhysicsBody, node1.Position, node2.Position); //YES. Works fine.
mySkScene.PhysicsWorld.AddJoint(joint);
(Other types of SpriteKit.SKPhysicsJoint can be created prior to the nodes being added to the scene-graph, although the nodes must be added to the scene-graph before SKPhysicsWorld.AddJoint is called.)