Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R3F example: Instanced Uniforms Mesh error on later versions of Three #274

Open
mokargas opened this issue Jul 25, 2023 · 1 comment
Open

Comments

@mokargas
Copy link

The R3F example with an updated stack (r154)
https://codesandbox.io/s/instanceduniformsmesh-r3f-forked-nqvrvl?file=/src/index.js

TypeError
Cannot read properties of null (reading 'attributes')
get geometry [as geometry]
https://nqvrvl.csb.app/node_modules/three-instanced-uniforms-mesh/dist/three-instanced-uniforms-mesh.esm.js:94:55
    at attach (https://nqvrvl.csb.app/node_modules/
react-three/fiber/dist/index-27578f8f.esm.js:621:40
    at appendChild (https://nqvrvl.csb.app/node_modules/
react-three/fiber/dist/index-27578f8f.esm.js:278:9

Not sure where to begin with this one, but my current guess is the API has moved on

@CodyJasonBennett
Copy link
Contributor

Geometry is not optional for InstancedUniformsMesh, you have to pass a non-null reference to its constructor. The surrounding design in three.js is notably awful since it has two optional arguments in front of a mandatory one, so you'll see [null, null, 1] passed to instanced mesh when used declaratively where mutably setting geometry/material is useful. That isn't the case here and they should be passed imperatively.

https://codesandbox.io/s/instanceduniformsmesh-r3f-forked-fsvdn7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants