Sprite kit skview.showPhysics bug?

旧时模样 提交于 2020-01-07 05:28:22

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!