Shadow for an whole building

I LOVE YOU! Your help here solved my issue in How to add shadows to imported child meshes? - Questions - Babylon.js (babylonjs.com)

These lines solved my issues:

let parent = scene.getMeshByName(“_ root _”);

// shadows handling
var shadowGenerator = new BABYLON.ShadowGenerator(2048, light);

let mymesh = parent.getChildMeshes();
for (var i = 0; i < mymesh.length; i++) {
mymesh[i].receiveShadows = true;
shadowGenerator.addShadowCaster(mymesh[i]);
}

3 Likes