Hello, i have a problem with the point light that make the lanter light in the village, i have set the start of the game in the village with 1,5 min for the day night cycle so you can notice that the light doesn’t affect the nearby objects and ignore the enable/disable function https://playcanvas.com/editor/scene/396696 start the game from editor and walk forward by clicking in the upper part of the screen and wait to see what i mean (just the table on the right shop seems to be affected by light…also in daylight when the light should be turned off).
this is the code
daynight: function() {
this.timestart=Date.now();
if (this.hour==='day') {
this.hour='night';
this.cubenight.loadFaces = true;
app.scene.skybox=app.assets.get(this.cubenight[0]).resource;
app.scene.skyboxIntensity=0.1;
app.scene.fogColor=new pc.Color(0,0,0);
app.scene.fog='linear';
app.scene.skyboxMip = 1;
this.light.light.color= new pc.Color(0,0.1,0.3);
var lamp=app.root.findByTag('light');
for (var i=0; i<lamp.length;i++) {
lamp[i].findByName('Directional Light').enabled=true;
lamp[i].model.model.meshInstances[7].material = app.assets.find('orange','material').resources[0];
}
} else {
this.hour='day';
this.cubemap.loadFaces = true;
app.scene.skybox=app.assets.get(this.cubemap[0]).resource;
app.scene.skyboxIntensity=1;
app.scene.fogColor=new pc.Color(0.3,0.4,0.5);
app.scene.skyboxMip = 1;
this.light.light.color= new pc.Color(0.7,0.7,0.7);
var lamp=app.root.findByTag('light');
for (var i=0; i<lamp.length;i++) {
lamp[i].findByName('Directional Light').enabled=false;
lamp[i].model.model.meshInstances[7].material = app.assets.find('lambert1','material').resources[0];
}
}
},