Hey guys, and I am looking through an example which uses the ReflectionProbe as follows:
var attachReflectionProbe = function (scene, root, others) {
var probe = new BABYLON.ReflectionProbe(root+“ReflectionProbe”, 128, scene, true);
for (var index = 0; index < others.length; index++) {
probe.renderList.push(others[index]);
};
root.material.reflectionTexture = probe.cubeTexture;
root.material.disableLighting = true;
probe.attachToMesh(root);
}
For use with typescript and ES6 I have converted the code to the following:
attachReflectionProbe (scene:Scene, root: Mesh, others: Mesh) {
var probe = new ReflectionProbe(root+“ReflectionProbe”, 128, scene, true);
for (var index = 0; index < others.length; index++) {
// The following line throws errors on compile
probe.renderList.push(others[index]);
};
(root.material as StandardMaterial).reflectionTexture = probe.cubeTexture;
(root.material as StandardMaterial).disableLighting = true;
probe.attachToMesh(root);
}
I am using strict checking and it throws the following error:
// The line number associated with the error is commented above
TS2531: Object is possibly ‘null’.
How can I access the list to add new meshes to it? It looks like the renderList parameter is read-only, and the RenderTargetTexture which hosts the value on ReflectionProbe is also inaccessible.
Thanks for any help,
r