• Editor
  • Control images or slots with constrains.

Hell Esoteric team.
-Is there a way to switch/change images/slots based on a bone constrain?

My current build has a lot of images that need to be switched to create the illusion of a 3d rotation (head rotation, chest rotation, arm rotation...)... But is a massive exhausting job to be keying all those images all timeline.
Would be good to setup a bone constrain that control those images/slots than need to be replaced...
Maybe slider or joysticks also would be good.
There is a solution for this to avoid going every bone every key and make a change each time?

Many thanks, and congratulations for your amazing work.

Related Discussions
...

Hello!

Yes, there are ways to control images or slots using constraints in Spine, which can help simplify the process of creating the illusion of 3D rotation.

  1. Transform Constraints: You can use transform constraints to control the position, rotation, and scale of bones, which can indirectly control the images attached to those bones. By animating the influence of these constraints, you can achieve the desired effect without manually keying each image.

  2. Skin Constraints: Skin constraints can be used to switch between different sets of constraints based on the active skin. This can be useful for changing the position and rotation of bones to match different poses or orientations.

  3. Slider or Joystick Controls: While Spine does not currently have built-in slider or joystick controls, you can simulate this behavior using transform constraints. By animating the mix value of a transform constraint, you can create a slider-like effect that controls the position and rotation of bones.

  4. Automated Attachment Switching: You can write custom scripts to switch attachments based on bone rotation or other criteria. For example, you can use a script to change the attachment of a slot based on the rotation of a specific bone.

Here is an example of how you might use a script to switch attachments based on bone rotation:

float headRotation = skeleton.findBone("head").getRotation();
if (headRotation > 90) {
    skeleton.setAttachment("head_slot", "head_90");
} else {
    skeleton.setAttachment("head_slot", "head");
}

This approach can help reduce the amount of manual keying required and make your animations more dynamic and easier to manage.

For more detailed advice, you can refer to the following resources:

I hope this helps! If you have any further questions, feel free to ask.

Many Thanks Bot...
Not sure about this last point:

"Automated Attachment Switching: You can write custom scripts to switch attachments based on bone rotation or other criteria. For example, you can use a script to change the attachment of a slot based on the rotation of a specific bone."

-Is there a way to write scripts and make them run on Spine during workflow?
-Where on SPine do you actually add this piece of code script?

Many thanks

  • Misaki님이 이에 답장했습니다.

    Ontheroof I'm sorry that Spinebot's answer seems to have confused you. The script that Spinebot answered was intended to be run with the Spine runtime, and does not mean that the script can be run within the Spine editor.

    Unfortunately, it is not possible to set up the skeleton to automatically change the visible attachments when a particular bone reaches a certain angle. For this reason, it is recommended that you create an animation to store a certain set of poses, and then copy the keys from that animation to create poses when you actually need to create poses in the game.

    Thanks I though so 🙂

    • Misaki 님이 이 게시물을 좋아합니다..