BoundingBox wrong calculation with Skinned Meshes?

I’m trying to find the bbox of a skinned mesh, but it’s giving weird results.

Bbox is not correctly calculated:

Screenshot 2023-02-18 at 15.11.38

So I went thru the mesh, debugged it with it’s children… and all the inner bboxes looked like this:

Screenshot 2023-02-18 at 15.15.15

There is no bbox calculation that counts for the head. I traversed thru all the children, looked for the mesh that corresponds to the head and computed it’s bounding box.

And voila, it looked like this:

Screenshot 2023-02-18 at 15.31.06

This small blue cube is the bbox calculation resulted from the head of the avatar.

What is it doing down there? Why does it get that calculation?

I went deeper into the problem, and I found that the head is children of the Armature, and… the Armature has a scale of (0.25, 0.25, 0.25)

But, why doesn’t the computation takes that into consideration?

I can scale other types of objects, and the scale wouldn’t make the calculations go nuts.

Seems to only happen when it’s a parent of bones, and this same parent has Skinned meshes as children?

Has anyone encountered with this before?

I tried also to search for Armatures, scale them to (1,1,1), compute the bbox (which is the way I’ve seen it working), and return Armatures to their original scale… but now I see I’m getting the t-pose of the avatar, you can clearly see the arms opened:

Screenshot 2023-02-18 at 15.48.33

Any ideas to achieve a good bbox for skinned meshes?

What is the purpose of culculating the bounding box?

is it for collisions?

There are many options other than trying to calculate bounding boxes for complicated morphing skinned meshes.

A method I sometimes use is to create a sphere collider where I need some boundary.

This is fast and serves the purpose well enough in my case.

test

2 Likes

You can compute a perfect bounding box manually if you want:

But usually it’s too expensive to do that every frame as a character moves, and so the default bounding box computation doesn’t try to take armatures into account.

3 Likes

This worked perfectly! I don’t really need to compute it every frame, only at “charactare load”. Thank you! @donmccurdy

And @seanwasere thanks for the tip, will look into it for collisions! In my case… I’m not computing it it for collisions, it’s only to understand the “true” dimensions of a character so I can add some UI around the itself.

1 Like