I’m having some trouble getting past my linter. I recently forced my project to being more strict gasps which caused one of my Babylon components to screech to a halt. I’m working with StandardMaterial like so:
const material = new StandardMaterial('AM', this._scene);
material.emissiveColor = Color3.White();
material.roughness = 1;
// Apply different effects based on substrate
switch (type) {
case Substrate.Canvas:
material.diffuseTexture = new Texture(url, this._scene);
material.detailMap.isEnabled = true;
material.detailMap.texture = new Texture(
`${this.assetBase}/textures/substrate_canvas.png`, this._scene
);
material.detailMap.texture.uScale = 3;
material.detailMap.texture.vScale = 3;
material.detailMap.diffuseBlendLevel = 0.4;
material.detailMap.bumpLevel = 0.5;
this.disableLighting();
}
The code itself works ie. somehow the detailMap gets applied and adjusted (I know this from disabling the linter). It also creates the effect that I want. The code is based on some examples I found. However when I add the linting in, it’s starts complaining:
TypeError: Cannot set property 'isEnabled' of undefined
There’s an 80% chance I’ve done some wildly wrong ie. I suspect detailMap was moved in a release and the doc/example I read is old OR perhaps the type definitions in TS are causing troubles? It’s just strange that my texture does end up being correct.
I’m on BJS 4.1.0