问题
I don't want to change ANYTHING other than the body that defines the shape of a SKPhysicsBody. How do I do this?
I can't seem to find where I can change this.
Or even commentary on how to change it.
Yes, I know this has to be done carefully, so that it avoids all possible new collisions, overlaps, etc. But putting that aside, how do I change the body of an SKPhysicsBody?
回答1:
You can manually create a custom shape for a physics body using CGMutablePath
, then pass it into the SKPhysicsBody
constructor.
For example:
let path = CGMutablePath()
path.move(to: CGPoint(.....))
path.addLine(to: CGPoint(.....))
let customPhysicsBody = SKPhysicsBody(edgeChainFrom: path)
来源:https://stackoverflow.com/questions/41532393/change-a-skphysicsbodys-body-shape