• Unity
  • how to hide the other Collider when play Animation.

Related Discussions
...

i have a spine file .the art add ColliderBone 。

we are make a STG Game.
so i wang the bullet shoot the enemy body.
this picture is a boss.

i play animation1 i want it can hide the other collider . but i don't know how.


some colldier can follow the anim but else need hide .

i want hide the collider when the bone not render .
or you can tell what's the right way .to hide

I have been able to achieve something similar (it was an sprite not a collider but it should not matter I think) by using a workaround with BoneFollower and scaling the bone to 0 (zero) in animations that the sprite shall not be visible.

There were a few times that I had need something similar to what you requested, but I had never managed to formulate what my exact needs are, nor how it shall be done.
I think it is a good idea to share my thoughts here, so the spine masters could help at least with the formulation of the idea.

  • I have been thinking of something like SlotFollower, but as far as I understood it there is no such thing as "position" for slots, but it could be quite useful for enable/disable gameobjects.
  • I have been thinking of something like AttachmentFollower, but have never completed a full idea here (it is something like the SlotFollower above, but enable a GameObject when the attachement is attached in a slot) They shall have some kind of a possition/rotation I guess?
  • As far as I understand how spine is working, there is no such thing as bone is not rendered, so there is no way for a bone to control GameObject's enable/disable state (maybe the only exception here are skins, but I am not too familiar with the implementation details of how bones are used when they are exclusive for a given skin).

You could use events to hide/show colliders. If your colliders are based on Spine's bounding boxes, you would hide/show the collider when the bounding box is hidden/shown. Even if not using bounding boxes directly, you could create bounding boxes in Spine (eg using 3 arbitrary vertices), but use them only to hide/show your colliders with the same name.