kzhsw
April 21, 2025, 7:05am
1
Engine: WebGL2
Version: 8.3.1
Playground: any
Steps to reproduce:
Open empty playground: https://playground.babylonjs.com/
Open Inspector
Click camera
Click “Turn on/off the camera’s gizmo”
Watch value of “Far plane”
Expected: value of “Far plane” not changed
Actual:
Related code (Introduced ~5 years ago ):
this._cameraMesh.parent = this._rootMesh;
}
if (this._cameraLinesMesh) {
this._cameraLinesMesh.dispose();
}
const linesColor = this._frustumLinesColor?.toColor4(1) ?? new Color4(1, 1, 1, 1);
this._cameraLinesMesh = CameraGizmo._CreateCameraFrustum(this.gizmoLayer.utilityLayerScene, linesColor);
this._cameraLinesMesh.parent = this._rootMesh;
if (this.gizmoLayer.utilityLayerScene.activeCamera && this.gizmoLayer.utilityLayerScene.activeCamera.maxZ < camera.maxZ * 1.5) {
this.gizmoLayer.utilityLayerScene.activeCamera.maxZ = camera.maxZ * 1.5;
}
if (!this.attachedNode!.reservedDataStore) {
this.attachedNode!.reservedDataStore = {};
}
this.attachedNode!.reservedDataStore.cameraGizmo = this;
// Add lighting to the camera gizmo
const gizmoLight = this.gizmoLayer._getSharedGizmoLight();
1 Like
kzhsw
April 26, 2025, 6:52am
5
Thank you for the fix, but if 2 camera is created, and showing the CameraGizmo
of one camera while the other camera is active, the active camera’s maxZ will be changed. Is this something expected? Why should there be this behavior?
Can you share a repro so that @Cedric will have a look when coming back from vacation.
kzhsw
April 30, 2025, 5:13am
7
Ok.
Steps to reproduce:
Open the empty playground https://playground.babylonjs.com/
Open Inspector
Right click on “Nodes” - “Add new free camera”
Click “camera1”, the value of “Far plane” should be 10000
Click “Turn on/off the camera’s gizmo” of “free camera”, the newly created camera
Watch value of “Far plane” changes (Current selected node is still “camera1”)
Expected: value of “Far plane” not changed
Actual: the image above CameraGizmo changes maxZ every time it shows - #5 by kzhsw
1 Like
I’ll take a look shortly!