Support for Spine animation "Bounding Boxes"


#1

To be able to utilize “Bounding Boxes” imported from a Spine JSON.


#2

Can you explain what your use case is?


#3

To easily implement collision boxes that collide with other objects and is set to do something within Defold via Script.

For example: If I have a Spine animation that “shoots a bullet” out of a gun, and a separate animation that is an “enemy death”. In Spine, I would then create a “boundng box” (which is attached to a bone) around each individual animation, and then being able to import the JSON into Defold where with a Lua script the “bounding boxes” would act as custom collision boxes where when the “bullet” animation collides with “enemy” then “enemy death” plays.

I hope this makes sense, and I feel this would really simplify the entire game development process and be more precise for collisions.


#4

You can attach game objects with collision components to bones though so it’s kinda similar sin’t it. The difference I guess would be that the collision shapes would be the same where as spine bounding boxes can be deformed.


#5

Thank you for your response! Is it possible to attach a collision box in Defold to any specific bone from a Spine animation?

For example, if I had a bullet shooting and my player / character combined into a single animation would I be able to attach several collision boxes based off specific bones.

In this case, a collision box to a bone on my character, and then a collision box attached to the bone that is the bullet (which follows the animated motion).


#6

You don’t attach individual collision objects to bones. What you do is that you attach game objects containing collision components to the bones.

Use spine.get_go("foo#myspinecomponent", "boneid") to get the game object for a bone. Then use “set_parent” to parent a game object to the bone.

This is obviously a bit cumbersome, but it would work.