Skip to content
Raiix edited this page Aug 8, 2021 · 2 revisions

How to load the Spine Animations exported from Spine Editor

  1. Add a SpineSprite node to your scene.
  2. Create a SpineAnimationStateDataResouce in Animation State Data Res property of the SpineSprite.
  3. Create a SpineSkeletonDataResource in Skeleton property of the SpineAnimationStateDataResource you just create.
  4. Drag the .atlas file into the Atlas Res property and the .json file into the Skeleton Json Res property of the SpineSkeletonDataResouce you just create. Make sure the .atlas file, .json file and the image files exported from Spine Editor are in the same directory.
  5. After loading in seconds, you should see the Spine animation shows up in the scene.

How to play the animations in Godot Editor

  1. Set the value of the Track Count property of the SpineSprite to 1.
  2. Choose the animation you want to play in the Animation property in the Id 0 group of the SpineSprite.
  3. Now you should see the SpineSprite is playing the animation you just choose.

How to generate AnimationPlayer for a SpineSprite

  1. Select the SpineSprite in the scene tree.
  2. Click the Animate button in the tool bar.
  3. Choose a AnimationPlayer to override or nothing to create a new one.
  4. Modify the settings in the dialog to meet your need.
  5. Click Generate/Override and you will see an AnimationPlayer node is created/ovrrided with the Spine animations.

How to bind a Node with a Slot in the SpineSprite

  1. Create a node as a child of the SpineSprite.
  2. Create an array with 1 element that is an array with 2 element in the Bind Slot Nodes property of the SpineSprite.
  3. The first element of the second array is the slot name you want the node to bind with that is a String type.
  4. The second element of the second array is the node path of which you just create.
  5. Assign the node path of the node.
  6. Now you should see the node's transform is synchronizing with the slot.

How to custom skins with SpineSprite

  1. Create a PackedSpineSkinResouce in the Packed Skin Resouce property of the SpineSprite.
  2. Set a unique name to the Skin Name property of the PackedSpineSkinResource.
  3. Create an array with the skin names in the Sub Skin Names property of the PackedSpineSkinResouce.
  4. Now you should see the skin you set shows up.

How to change a bone's transform in the SpineSprite

  1. Make sure you have loaded the Spine animation resources in the SpineSprite.
  2. Call the get_skeleton() method of the SpineSprite to get the runtime skeleton.
  3. Call the find_bone(bone_name) method of the SpineSkeleton to get the bone.
  4. Call the get_godot_global_transform() method of the SpineBone to get the global transform of the bone.
  5. Call the set_godot_global_transform(global_transform) method of the SpineBone to set the global transform of the bone.

How to use the bounding box in the SpineSprite

  1. Add a SpineCollisionShapeProxy to your scene.
  2. Assign the node path of the SpineSprite to the Spine Sprite Path property of the SpineCollisionShapeProxy.
  3. Choose the slot to which the bouding box is attached.
  4. Now the SpineCollisionShapeProxy has the shape exactly the same as the bouding box you choose.