brianzinn / react-babylonjs

React for Babylon 3D engine
https://brianzinn.github.io/react-babylonjs/
809 stars 102 forks source link

Model property scaleToDimension #281

Closed jinincarnate closed 1 year ago

jinincarnate commented 1 year ago

what is the model property scaleToDimension is it used for.

<Model key={counter} name={sceneName.split('.')[0]} reportProgress position={new Vector3(0, 0, 0)} rootUrl="models/" sceneFilename="test.glb" scaleToDimension={400.0} onModelLoaded={(model) => onLoaded(model)} id="someid" />

brianzinn commented 1 year ago

it's meant to scale to the largest dimension. so what you have there is to scale the object to 400 meters.

If the longest dimension of your bounding box is 4, for example, then it will scale x 100 (make it 100 times larger). I typically use that property to fit different models into a specific space - it was originally designed for a remix 3d mashup that I made. It should be optional and then leaving it out will not do any scaling.