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

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -