From b7caeeacf1947b1cbe9c067f4dbf677500571967 Mon Sep 17 00:00:00 2001 From: Carolina Herbster Date: Mon, 25 Apr 2022 13:50:40 -0300 Subject: [PATCH] [Bug] Fix camera cloning by adding newParent parameter --- packages/dev/core/src/Cameras/camera.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/dev/core/src/Cameras/camera.ts b/packages/dev/core/src/Cameras/camera.ts index 6fbb6d03760..acfa9f4552d 100644 --- a/packages/dev/core/src/Cameras/camera.ts +++ b/packages/dev/core/src/Cameras/camera.ts @@ -1283,14 +1283,16 @@ export class Camera extends Node { /** * Clones the current camera. * @param name The cloned camera name + * @param newParent The cloned camera's new parent (none by default) * @returns the cloned camera */ - public clone(name: string): Camera { + public clone(name: string, newParent: Nullable = null): Camera { const camera = SerializationHelper.Clone( Camera.GetConstructorFromName(this.getClassName(), name, this.getScene(), this.interaxialDistance, this.isStereoscopicSideBySide), this ); camera.name = name; + camera.parent = newParent; this.onClonedObservable.notifyObservers(camera);