Hello all. I’m trying to create a lit scene in the THREE.js Editor, but I was having trouble exporting shadow casting / receiving to GLTF. I decided to add a script to the scene that iterates through all children, and if it has shadow casting enabled, it would add that to the userData of the child (like below). Unfortunately, it looks like the userData change doesn’t reflect to the actual editor, and is overwritten immediately. Is there a way to get around this, or am I just doing something wrong?
function start( event ) {
this.traverse(child => {
if (child.castShadow) {
child.userData.castShadow = true;
console.log(child); // reflects userData change, but after the start() function completes, the changes are lost
}
});
}
Edit: I’ve also noticed that my script can’t properly read the userData either. Regardless of what’s actually stored in there (set using the text field), it always shows as an empty JSON object (but not undefined).