Skip to main content

LensStudio:HierarchyUtils.js.getNearestOrFirstCamera

Function

Finds the nearest camera ancestor of a scene object, if one exists.

getNearestOrFirstCamera(sceneObject, scene, cameraType?): SceneObject

Finds the nearest camera ancestor of a scene object, if one exists. if not, it returns the first camera in the scene.

Parameters

ParameterTypeDescription
sceneObjectSceneObjectThe scene object to search for orthographic camera ancestors.
sceneScene-
cameraType?CameraTypeThe type of camera to search for, or null to find any camera.

Returns

SceneObject

The nearest camera ancestor of the scene object, or null if none is found.