Resize

    Demo

Calculates a boundary box and scales its children so the highest dimension is constrained by 1. NB: proportions are preserved.

export type ResizeProps = JSX.IntrinsicElements['group'] & {
  /** constrained by width dimension (x axis), undefined */
  width?: boolean
  /** constrained by height dimension (y axis), undefined */
  height?: boolean
  /** constrained by depth dimension (z axis), undefined */
  depth?: boolean
  /** You can optionally pass the Box3, otherwise will be computed, undefined */
  box3?: THREE.Box3
  /** See https://threejs.org/docs/index.html?q=box3#api/en/math/Box3.setFromObject */
  precise?: boolean
}
<Resize>
  <mesh />
</Resize>

You can also specify the dimension to be constrained by:

<Resize height>
  <Box args={[70, 40, 20]}>
</Resize>