Derek 朕會功夫 Derek 朕會功夫 - 1 year ago 81
Javascript Question

How to make COLLADA models cast shadow on its own?

I tried this:

dae.castShadow = true;
dae.receiveShadow = true;

//spotLight is defined already.
spotLight.castShadow = true;

renderer.shadowMapEnabled = true;

But the model still does not have shadows? Did I do anything wrong? Please help.

Answer Source

You need to set castShadow and receiveShadow to true for all the objects in the hierarchy.

THREE.SceneUtils.traverseHierarchy( dae, function ( child ) {

    child.castShadow = true;
    child.receiveShadow = true;

} );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download