Sorry to dig/necro this but it’s a top result in google for this problem and it doesn’t work in Typescript
blocksRender.ts:171 Uncaught TypeError: Cannot set property material of [object Object] which has only a getter
What is the suggestion for Typescript? Why do we even need to reassign the same material to the instance?
Thanks!
/edit
A minute later I combed over the code and realized we don’t need to reassign the same material. My shader uses the distance from the camera to the instance, but I wasn’t transforming the position by the included finalWorld from #include<instancesVertex> T_T
So for some clarity:
The shader example uses: #include<instancesDeclaration>
and #include<instancesVertex>
and multiplies/transforms the original vertex position by the finalWorld instance transform instead of using the position attribute directly.