While trying to make a trivial avatar with a single triangle at a single point, I ran into a bug where both the SDK and the game miscompute the avatar's bounds as extremely wide if the avatar itself is not at (0.0, 0.0, 0.0), even though the avatar has extremely tiny bounds. This means that my avatar can be Very Poor, and then I walk 5 metres across the room, check again, and now it's Excellent.
Setup:
* New empty object 'Avatar':
* Set transform to (10.0, 0.0, 0.0)
* Add VRC_AvatarDescriptor
* Under 'Avatar', new empty object 'Body':
* Set transform to (0.0, 1.0, 0.0)
* Add Mesh Filter
* Set a mesh to the mesh filter with bounds (0.0, 0.0, 0.0) - e.g. a single triangle made up of three vertices which are all (0.0, 0.0, 0.0).
* Add Mesh Renderer, set Default-Material (possibly not required)
* Go to the VRChat tab, check Show All Avatar Performance Details
Expected results:
* Bounding box should have size: (0.0, 1.0, 0.0).
* Reasoning:
* Avatar itself is at (0.0, 0.0, 0.0)
* The child node is at (0.0, 1.0, 0.0)
* Smallest box enclosing both of these is (0.0, 1.0, 0.0). I would also accept (0.0, 0.0, 0.0) perhaps.
Actual results:
* Bounding box has size: (10.0, 0.0, 0.0)
* Investigation:
* go.transform.position = (10.0, 0.0, 0.0)
* At start, bounds = Center: (10.0, 0.0, 0.0), Extents: (0.0, 0.0, 0.0)
* Adding renderer:
r.bounds = Center: (0.0, 0.0, 0.0), Extents: (0.0, 0.0, 0.0)
new bounds = Center: (5.0, 0.0, 0.0), Extents: (5.0, 0.0, 0.0)
This is the bug - r.bounds is in local coordinates, but bounds is in world coordinates, but the two values have been used together in the same statement.
* At end, subtracting go.transform.position again:
bounds = Center: (-5.0, 0.0, 0.0), Extents: (5.0, 0.0, 0.0)
* Resulting AABB.size = (10.0, 0.0, 0.0)