pmndrs / drei

🥉 useful helpers for react-three-fiber
https://docs.pmnd.rs/drei
MIT License
8.42k stars 708 forks source link

TypeError: Cannot read properties of undefined (reading 'elements') - MeshReflectorMaterial #2138

Open sovetski opened 3 weeks ago

sovetski commented 3 weeks ago

Problem description:

With the code below I am getting this error: TypeError: Cannot read properties of undefined (reading 'elements')

Relevant code:

          <mesh position={[0, -1.5, 0]} rotation={[-Math.PI / 2, 0, 0]}>
              <planeGeometry args={[50, 50]} />
              <MeshReflectorMaterial
                  blur={[400, 400]}
                  resolution={1024}
                  mixBlur={1}
                  mixStrength={15}
                  depthScale={1}
                  minDepthThreshold={0.85}
                  color="#dbecfb"
                  metalness={0.6}
                  roughness={1}
              />
          </mesh>
abernier commented 5 days ago

@sovetski can you paste the error's calls stack?

sovetski commented 3 days ago

@abernier sure:

TypeError: Cannot read properties of undefined (reading 'elements')
    at Vector3.setFromMatrixPosition (http://localhost:3000/_next/static/chunks/2fd53_three_build_three_module_bcbc2d.js:3488:21)
    at MeshReflectorMaterial.useCallback[beforeRender] (http://localhost:3000/_next/static/chunks/10bfa_@react-three_drei_c48812._.js:1652:36)
    at MeshReflectorMaterial.useFrame [as current] (http://localhost:3000/_next/static/chunks/10bfa_@react-three_drei_c48812._.js:1781:13)
    at update (http://localhost:3000/_next/static/chunks/1303a_@react-three_fiber_dist_b28a6f._.js:2092:26)
    at loop (http://localhost:3000/_next/static/chunks/1303a_@react-three_fiber_dist_b28a6f._.js:2118:23)