A conflict between 'Custom BoundingInfo' and 'Geometry.applyToMesh'

My expectations

  • I want to set a custom boundinginfo for my mesh when importing.

My steps:

  • If the ‘boundingbox’ attribute is read in the gltf extension
  • new BoundingInfo && isLocked = true

My Obstacles:

  • the data called ‘geometry’ will be analyzed in ‘Promise’
  • then, ‘mesh._boundingInfo = new BoundingInfo’ will appear in ‘Geometry.applyToMesh’, overwrite my custom info.

And, maybe, we should check ‘this._boundingInfo && this._boundingInfo.isLocked’ before setting ‘mesh._boundingInfo’? Is there any other way to stop changing “Mesh._boundingInfo”?

Thanks.

Pinging @bghgary

I think you are saying you are adding a custom glTF loader extension that parses a custom glTF extension that has bounding box information. If so, can I ask which glTF loader extension function you are overriding? I would expect _loadMeshPrimitiveAsync? If so, please be careful with this API since it is still subject to change. All functions prefixed with underscore _ are subject to change.

I think ideally, yes. I have a work item to use the min and max property from the accessors instead of compute them which has similar issues. For now, can you set the bounding info after the promise completes so that you override the default one that is computed?

2 Likes

I got it, and it works correctly.
Thanks :+1:

1 Like

In fact, I need use a custom gltf data structure in my work environment, because there are too many little objects in the standard gltf. So the loading process has done some customization. :sweat_smile:

1 Like