LightGizmo attaching a node

I am using a LightGizmo and when it it attached to a node and then the light is set an error is thrown here:
Babylon.js/lightGizmo.ts at master · BabylonJS/Babylon.js (

Is it intentional that the LightGizmo shouldn’t be attached to nodes (allowed by base class, which clears attachedMesh property)?

The error is Cannot read property 'reservedDataStore' of null. If the answer is that LightGizmo should not be attached to nodes that is OK. I can see how the light setter could accomodate either way the reservedDataStore is inherited from Node ( Node | Babylon.js Documentation ( Cheers.

@brianzinn could you please provide a repro in the playground ?

I can see what is going on here and yes LightGizmo can only work with the light setter, and attachedMesh or node should not be set or it would create issues :frowning:

@Cedric I guess we should override those properties to prevent crashes in the lightGizmo ?

I am currently able to set an attachedMesh, but not an attachedNode with a light :slight_smile: The mesh is useful to have a mesh representing the light.

1 Like

Checking attachedMesh in the lightGizmo looks like a mistake to me. I don’t see we can’t do it with a node. Just like what has been done for the cameraGizmo. Let me do some tests …

EDIT: Only meshes can be attached actually. Adding a warning when trying to do so

1 Like