问题

Here is the code for setting the characters physics body.
character.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:character.size];
It works fine, I mean it stays where I want it to but as you can see it displays the character
's physics body in the bottom left of the screenshot (which is the grey box).
Is this a bug or can this be fixed?
回答1:
I had a similar problem which may or may not solve yours.
It looks like you are using some sort of viewport system. Perhaps with a node called world
and one called camera
? If this is the case then you must be moving your world
node every frame in order to center the content correctly? When drawing physics, you need to move the world
node at -didEvaluateActions
instead of -didSimulatePhysics
来源:https://stackoverflow.com/questions/23483297/sprite-kit-skview-showphysics-bug