Why is Mesh.showBoundingBox not available as a prop?
I was hoping to write the following:
function MyComp() {
return (<box name="myBox" showBoundingBox={true} />);
}
But no such prop is available. So instead I need to do the following:
function MyComp() {
const ref = useRef(null);
useEffect(() => {
if (ref.current) {
ref.current.showBoundingBox = true;
}
}, []);
return (<box name="myBox" ref={ref} />);
}
Interestingly showSubMeshesBoundingBox prop is available. But no showBoundingBox.
Using version 3.2.2 of react-babylonjs.
Well, agree it should be there. The reason it's not showing is because it's declared here: https://github.com/BabylonJS/Babylon.js/blob/84580a00705d4513393988e3eb2cab0f2d9053b3/packages/dev/core/src/Rendering/boundingBoxRenderer.ts#L75
I'm using ts-morph to generate the props. Let me look into it. The prop you did find is declared on AbstractMesh:
https://github.com/BabylonJS/Babylon.js/blob/84580a00705d4513393988e3eb2cab0f2d9053b3/packages/dev/core/src/Meshes/abstractMesh.ts#L602
it's a bit hideous, but can be added following same way instancedBuffers were added, since it's declared in a different area of the code base of babylon.js and dynamically applied:
https://github.com/brianzinn/react-babylonjs/blob/master/packages/react-babylonjs/tools/generate-code.ts#L509