What strategy would you use to update the AABBs of a skinned mesh during animation for collision detection. E.g. if I want to detect if the dragon’s hand has intersected with an object to pick it up. I am thinking of using the bones to quickly compute the AABBs during each frame.
The AABBs that come with the model in the glTF accessor are inaccurate as shown. For example, we want to have separate AABBs for the wings and hands, and then test for collisions against the triangles inside the AABB once an AABB intersection is found.
With the tank, it is easier, as the glTF file uses separate meshes for the parts and the AABB for each mesh can be transformed while the tank is animated
Since there haven’t been any replies here in a few days — I think you might have more luck with this type of question somewhere like a gamedev forum / Slack / Discord. I’m not sure you’d want to tie your application’s animation and collision handling systems to any particular input format like glTF.
In general there is no requirement that vertices influenced by a joint must be spatially close to that joint, and multiple joints can influence the same vertex, so computing a strict bounding box per bone is not guaranteed to be possible. I suspect there’s more art than science to it.
Maybe you can do something like what we (Babylon.js) do for computing the model’s max extents to make sure the model doesn’t go out of view when framing the model in our viewer. The computeMaxExtents function computes the maximum extents of the given meshes considering animation, skeleton, and morph targets.
Thanks for your reply. I want something more refined, like computing a hierarchy of AABBs to identify collisions between each body part.
Potentially, the artist may attach an OBB per bone, and the programmer just transforms the OBBs during each frame. The AABBs can be directly calculated from the OBBs.