ios - Mirror SpriteKit node that has pinned children -
the question be: how mirror pinned spritekit node along nodes axis?
i'm developing 2d platform game spritekit. hero sknode functions container body parts.
hero:sknode --- leftarm:skspritenode --- rightarm:skspritenode --- body:skspritenode
leftarm , rightarm pinned body node (through skphysicsjointpin).
i want mirror hero horizontally when changes direction. when change xscale -1 gets mirrored pinned nodes mirrored along own axis , not along bodies axis/parent nodes center.
i tried manually adjust pinned nodes position without effect (seems not allowed pinned nodes).
how can mirror pinned nodes along body nodes axis or change position independently?
i found approach worked me change pinned node's position independently.
- adjust pinned nodes position
- get pinned nodes joint(s) (through pinnednode.physicsbody.joints)
- remove joint physicsworld
- create new joint same parameters removed 1 , add world
Comments
Post a Comment