I'm having trouble adding the castShadow
and receiveShadow
properties to an object in my code. Can someone please point out what I'm doing wrong?...
var mtlLoader = new THREE.MTLLoader();
mtlLoader.setPath("objects/Tree/");
mtlLoader.load("tree.mtl", function(materials) {
materials.preload();
var objLoader = new THREE.OBJLoader();
objLoader.setMaterials(materials);
objLoader.setPath("objects/Tree/");
objLoader.load("tree.obj", function(gate) {
var positionX = 0;
var positionY = 4;
var positionZ = 0;
gate.position.x = positionX;
gate.position.y = positionY;
gate.position.z = positionZ;
gate.scale.x = 2
gate.scale.y = 2;
gate.scale.z = 2;
scene.add(gate);
gate.castShadow = true;
gate.receiveShadow = true;
});
});