Skip to main content

LensStudio:HierarchyUtils.js.findOrCreateCameraObject

Function

Finds or creates a camera object of the specified type within the given scene.

findOrCreateCameraObject(scene, cameraType, bearerSceneObject?): SceneObject

Finds or creates a camera object of the specified type within the given scene.

Parameters

ParameterTypeDescription
sceneSceneThe scene in which to find or create the camera object.
cameraTypeCameraTypeThe type of camera to find or create (Orthographic or Perspective).
bearerSceneObject?SceneObjectOptional. The scene object to which the new camera will be attached if created.

Returns

SceneObject

The scene object containing the camera of the specified type.

Throws

Will throw an error if the camera type is invalid.