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.

  1. adjust pinned nodes position
  2. get pinned nodes joint(s) (through pinnednode.physicsbody.joints)
  3. remove joint physicsworld
  4. create new joint same parameters removed 1 , add world

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -