The spine docummentation shows how to scale the skeleton when loading. Is it a must to reload the skeleton to scale the animation while playing it?

  • \$\begingroup\$ Do you mean scale it as part of the animation data, or procedurally when rendering it in your game? \$\endgroup\$
    – Anko
    Oct 4 '14 at 11:02
  • \$\begingroup\$ I need to do is procedurally, since my character moves in a virtual z axis in my 2d game and I need to make it smaller or bigger. \$\endgroup\$
    – freesoul
    Oct 4 '14 at 11:17
  • \$\begingroup\$ Which runtime are you using? \$\endgroup\$ Oct 4 '14 at 12:58
  • \$\begingroup\$ I'm using SFML library \$\endgroup\$
    – freesoul
    Oct 4 '14 at 13:45
  • \$\begingroup\$ SFML doesn't have built-in support for skeletal animation, is it possible you're using this project? \$\endgroup\$
    – bcrist
    Oct 5 '14 at 11:21

This is done by manipulating the bone directly, as in this documentation: http://esotericsoftware.com/spine-using-runtimes#Manipulating-bones

The key here is that you have to perform the operation after calling AnimationState_update/apply but before calling Skeleton_updateWorldTransform:

Skeleton_update(spine->_Skeleton, dt);
AnimationState_update(spine->_AnimationState, dt);
AnimationState_apply(spine->_AnimationState, spine->_Skeleton);

// Now that the animation has applied any changes, provide our own manipulations:
spine->_Skeleton->x = transform->position.x;
spine->_Skeleton->y = transform->position.y;
spine->_Skeleton->root->scaleX = 0.5f;
spine->_Skeleton->root->scaleY = 0.5f;

spine->_Skeleton->root->rotation = 45.0f;


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.