How to rotate sprites around a joint

杀马特。学长 韩版系。学妹 提交于 2019-11-29 10:34:43

You can make the arms and hands children of a common parent node. You could create a blank SKNode for just this purpose like so:

let armsParent = SKNode()

Then instead of adding the arms and hands as children to the scene directly, add them as children of armsParent like so:

armsParent.addChild(leftArm)
armsParent.addChild(rightArm) // same for hands...

Then you can simply rotate armsParent with an SKAction to achieve what you want.

OR, to make it even simpler, you could just add the arms and hands as children to hook directly like this:

hook.addChild(leftArm) // same for other arm and hands...

Since the arms and hands are children of hook or armParent their positions will now be determined relative to their parent. So you might have to change all your .position = initialization code to accommodate this.

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