How to find 3d model starting and end point of the scene

Hi guys,

I need help.

How can i achieve this,

Based on the given value, the 3D model should be replicated and added to the end of the previous three 3D models.

How to find 3d model starting and end point of the scene.

thanks…

you can use three.box3 for this. it will calculate the bounds of something. call it inside a useEffect for instance.

but there’s something better in drei:

center allows you to … center GitHub - pmndrs/drei: 🥉 useful helpers for react-three-fiber
resize normalises size GitHub - pmndrs/drei: 🥉 useful helpers for react-three-fiber
bbanchor can anchor something onto something else, and that’s the most useful for you GitHub - pmndrs/drei: 🥉 useful helpers for react-three-fiber

for instance, pin bar to positive x , positive y , and positive z corner of foo

<mesh geometry={foo}>
  <BBAnchor anchor={[1, 1, 1]}>
    <mesh geometry={bar} />
  </BBAnchor>
</mesh>

generally check out drei: GitHub - pmndrs/drei: 🥉 useful helpers for react-three-fiber it contains many of the issues that people have struggled with before.

Thank you @drcmda
I solved, did you mentioned this new THREE.Box3().setFromObject(obj);

1 Like