想要将图像作为边界添加到spriteNode物理体,图像可能会动态变化,图像应该是spritenode的边界。
答案 0 :(得分:0)
您可以从纹理创建physicsBody,并在更改图像时重新指定body
目标C:
SKTexture *texture = [SKTexture textureWithImageNamed:@"imageFileName"];
myNode.physicsBody = [SKPhysicsBody bodyWithTexture:texture size:texture.size];
夫特:
let texture = SKTexture(imageNamed: "imageFileName");
myNode.physicsBody = SKPhysicsBody(texture: texture, size: texture.size());