Cannot set property receiveShadows of [object Object] which has only a getter with ES6

I’m getting the error message above when using ES6. Trying to allow mesh to receive shadows. It won’t let me assign true/false value directly to that property.

Instanced meshes only have the getter, so try:

instance.sourceMesh.receiveShadows

That doesn’t work out for me.

I’m assuming you mean “source” because there is no property “sourceMesh”.
For all my meshes none of them have a source mesh. The “source” property is either NULL or undefined.

I did mean sourceMesh, which is a property instanced meshes do have, and they are the only kind of mesh that only have the getter. The other one is AbstractMesh, which has both a getter and a setter for receiveShadows.

My instanced meshes do have the “source” property and the type is “object” but the value for all of them is null.

I don’t know how to access the AbstractMesh object from my mesh

Can you try to repro in the playground (in TS mode) ?