• Unity
  • Bounding box not changing in runtime

Hello,
I have an animation with a bounding box collider. When I check the preview of the animations on the SkeletonData object in Unity, I can see that the collider is updating every frame.
Then I add the bounding box follower, choose the slot and the PolygonCollider is created correctly.
However, the collider is not updated at runtime. The first frame collider remains.

In addition, the bounding box is a mesh collider that was edited in Spine for each frame of the animation.

How can I fix the update of the collider?

Related Discussions
...

Unfortunately currently BoundingBoxFollower in spine-unity does not yet track vertex deformation animation of the BoundingBoxAttachments, it only generates them once at the start and tracks which BoundingBoxAttachment is enabled at a Slot at the current frame of the animation. I have updated the documentation section to more explicitly state this.

Please note that even if this were possible, it would be very much discouraged as it's costly for the physics engine to update the vertices of moving colliders every single frame. In general you should always consider using rectangular bounding shapes for moving objects in favour of mesh- or polygon colliders.

ias wrote

The first frame collider remains.

Do you switch between multiple BoundingBoxAttachments that are enabled at different timepoints in your animation? Enabling and disabling them should be tracked by the BoundingboxFollower component.

5일 후

No, it is one collider which is deformed during the animation. OK, so there it is no option to handle this?
But why I can see the collider deformation in Unity in the preview inspector window? When the SkeletonData object is selected.
It seems that the information is being processed.

There is no option currently, no.

ias wrote

But why I can see the collider deformation in Unity in the preview inspector window? When the SkeletonData object is selected.
It seems that the information is being processed.

The preview is a bit misleading in this case, you're right about that. It displays the currently active bounding box attachment at a given frame, regardless of whether it will be used at runtime or not. The information is in the file of course, but it's not utilized the same way in the BoundingBoxFollower as displayed in the preview currently.

Of course you could adapt the code to update it every frame, however as stated above it's not recommended to do that for performance reasons.