Skip to main content

LensStudio:HierarchyUtils.js.findNearestCameraInAncestors

Function

Finds the nearest camera in the ancestors of the given scene object.

findNearestCameraInAncestors(baseSceneObject, cameraType?, maxDepth?): SceneObject

Finds the nearest camera in the ancestors of the given scene object.

Parameters

ParameterTypeDescription
baseSceneObjectSceneObjectThe scene object from which to start the search.
cameraType?CameraTypeThe type of camera to search for (e.g., Orthographic, Perspective). Use null for any type.
maxDepth?numberMaximum search depth. Default is 1000.

Returns

SceneObject

The nearest matching camera or null.