title: How to get all Object3D's from a Canvas in three-react-fiber
body: <p>I'm working on my first App using react-three-fiber. I currently generate the Viewport like this:</p>
  <pre><code>
  const Viewport = (props) =&gt; {
  
    return (
      &lt;Canvas
        onCreated={({ gl, raycaster }) =&gt; {
          gl.setClearColor(&quot;darkgrey&quot;);
          props.setraycaster(raycaster);
        }}
      &gt;
        {/* Canvas Config */}
        &lt;CameraControls /&gt;
        &lt;ambientLight intensity={0.5} /&gt;
  
        {/* Objects */}
        {props.scene.objects.map((o, i) =&gt; (
          &lt;Suspense fallback={&lt;LoadingBox /&gt;} key={i}&gt;
            &lt;Element3D obj={o} displaymode={props.displaymode} key={i} /&gt;
          &lt;/Suspense&gt;
        ))}
      &lt;/Canvas&gt;
    );
  };
  </code></pre>
  <p>As you can see, I'm taking a model of what should be displayed in the Viewport in the props, and then displaying them as Element3D components in a canvas.<br />
  I also want to do raycasting in another part of my App, to check occlusion between objects. For this, I need to tell the raycaster all objects it should consider.
  So, I need a list of all Object3Ds that end up on my Canvas. My question is how I would get such a list.</p>
  <p>In case you need to know, this is the important part of the Element3D component:</p>
  <pre><code>const scene = useLoader(OBJLoader, props.obj.meshPath);
  
  return (
    &lt;primitive object={scene.children[0]}&gt;
      {
        &lt;meshBasicMaterial
          attach=&quot;material&quot;
          transparent
          side={THREE.DoubleSide}
        &gt;
          &lt;primitive attach=&quot;map&quot; object={texture} /&gt;
        &lt;/meshBasicMaterial&gt;
      }
    &lt;/primitive&gt;
  )
  </code></pre>