Jump to content
biminiroad

SpriteKit implementation help

Recommended Posts

Hello! I'm using this implementation https://github.com/indieSoftware/INSpriterKit as a basic for my Swift SpriterKit project, and am running into the same problem as the author trying to get bone scaling to work. I've looked at other implementations and it seems they all unmap relative positions and scales from parents. However SpriteKit applies a parent's properties onto its children already so I figured this wouldn't be an issue, but there are certain GreyGuy examples where bones without 1,1 scaling end up looking wrong.

Has anyone run into anything similar? I can try explaining in more detail if there's any confusion, but any knowledge or guide in a general direction would be great. Thank you!

Share this post


Link to post
Share on other sites

Spriter uses rigid transformations and scaling to work on many 2d engines where sprites can't be skewed or distorted.  Because of this, for each child, you need to apply scale before angle, to prevent 'squashing' and replicate the way it looks in Spriter.

Scale * parentScale,

Angle + parentAngle,

Position * parentScale (rotated around parentPosition by parentAngle degrees)

Share this post


Link to post
Share on other sites

Thanks! That ordering might be it, but after some playing around, I believe it's all on SpriteKit itself. For anyone else that might be using it, I found this unresolved question on StackOverflow that seems similar: http://stackoverflow.com/questions/33770176/spritekit-node-zrotation-doesnt-keep-aspect-ratio-of-node-when-child-of-another#comment65871923_33770176 

It might be expected behavior for SpriteKit, but applying rotations and scaling to ancestors morphs the child node. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...