• Editor
  • Get size of the Skeleton?

Related Discussions
...

So currently I'm stuck trying to make a physics body for my Skeleton.

Normally when working with the sprite in objective-c it would be.

_player.physicsBody = [SKPhysicsBody bodyWithCircleOfRadius:sprite.size.width/2];

Now my problem lies right here.

bodyWithCircleOfRadius:sprite.size

Specifically the .size, when working with SKSpriteNodes you can call .size to get their size. Well I'm no longer working with SKSpriteNodes, instead I'm working with a SpineSkeleton *playerSkeleton; and SKNode *player; None of which have a .size method. I know the general size I want but I prefer not to hard-code it, am I missing something?

Thanks!

A skeleton doesn't really have a single size. It has a number of animations that pose the skeleton in various ways. For any given pose you could compute the size. This is done in SkeletonRenderer's boundingBox method.

You could hardcode it. You could use a bounding box in Spine and get its size (or the AABB size) at runtime using the SkeletonBounds class.