SKAction.moveByX not setting physicsBody.velocity

不羁岁月 提交于 2019-12-01 14:38:07

Actions and physics are largely separate mechanisms in SpriteKit. Generally, if you're using physics to move a body, you shouldn't use move actions on it. If you want to move a body that's already using physics, use physics to move it -- apply a force or impulse, or set its velocity directly.

Conversely, when you use actions to move a body, or set its position directly, those changes don't go through the physics engine. If you want to find the speed of a node during a move action, you'll have to calculate it yourself by observing the change in its position between frames.

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