Hi, I want to make some computations only when camera moved or size of canvas changed. Is it nice approach?
let cacheMatrix = this._scene.getTransformMatrix().clone();
this._scene.onBeforeRenderObservable.add((scene) => {
let matrix = scene.getTransformMatrix();
if (!matrix.equals(cacheMatrix)) {
cacheMatrix = matrix.clone();
this.onTransformMatrixChangedObservable.notifyObservers(cacheMatrix);
}
});