Update Polygon Collider 2d on skeletal animations

Hello there,

the title is pretty much self-explanatory. I’d like to update my polygon collider 2d every frame to match the skeletal animations 2d that I create.
Is there a way to do so?

Thank you

No and it’d be pretty expensive to do so; especially so because physics doesn’t even run per-frame. A PolygonCollider2D isn’t a single primitive shape, it’s path(s) that form outline(s) that it then has to decompose into multiple convex polygons.

Yeah I know it’s expensive, but I would use only for a simple game with high precision.
Anyway, the only thing I can do is to generate some spritesheet animation and map a collider on every animation frame, and update PolygonCollider2D with these colliders when animation is called. Right?

If you feel that this kind of collision fidelity is worth the expense then sure.

1 Like