SKPhysicsJointLimit.Create メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
2つの物理体の間にロープ状の接続を作成するためのファクトリメソッド。
[Foundation.Export("jointWithBodyA:bodyB:anchorA:anchorB:")]
public static SpriteKit.SKPhysicsJointLimit Create (SpriteKit.SKPhysicsBody bodyA, SpriteKit.SKPhysicsBody bodyB, CoreGraphics.CGPoint anchorA, CoreGraphics.CGPoint anchorB);
static member Create : SpriteKit.SKPhysicsBody * SpriteKit.SKPhysicsBody * CoreGraphics.CGPoint * CoreGraphics.CGPoint -> SpriteKit.SKPhysicsJointLimit
パラメーター
- bodyA
- SKPhysicsBody
- bodyB
- SKPhysicsBody
- anchorA
- CGPoint
- anchorB
- CGPoint
戻り値
- 属性
注釈
SKNodeに関連付けられている bodyA
がbodyB
、このメソッドまたは Sprite Kit を呼び出す前に にSKScene追加する必要があります。 次の例は、適切な順序を示しています。
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);
(他の種類の ノード SKPhysicsJoint をシーン グラフに追加する前に作成できますが、呼び出す前 AddJoint(SKPhysicsJoint) にノードを scene-graph に追加する必要があります)。