Lens Scripting API

    Class SceneObject

    An object in the scene hierarchy, containing a Transform and possibly Component. A script can access the SceneObject holding it through the method script.getSceneObject().

    // Look for a MaterialMeshVisual on this SceneObject
    var sceneObj = script.getSceneObject();
    var meshVisual = sceneObj.getComponent("Component.MaterialMeshVisual");
    if(meshVisual)
    {
    // ...
    }
    // Rename each child SceneObject
    var sceneObj = script.getSceneObject();
    for(var i=0; i<sceneObj.getChildrenCount(); i++)
    {
    var child = sceneObj.getChild(i);
    var newName = i + "_" + child.name;
    child.name = newName;
    print(child.name);
    }

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Properties

    children: SceneObject[]

    Get an array of the scene object's children.

    enabled: boolean

    Whether the SceneObject, including its components and children, is enabled or disabled.

    isEnabledInHiearchy: boolean

    Check if a SceneObject is enabled in the hiearchy. It is enabled if both its own enabled property is true, and that of all of its parents to the root of the scene.

    isEnabledInHierarchy: boolean

    Returns true if this SceneObject and all of its parents are enabled.

    layer: LayerSet

    Gets or sets the LayerSet of layers this SceneObject belongs to. This is used to determine which Camera will render the SceneObject.

    name: string

    The name of the SceneObject.

    onDisabled: event0<void>

    An event that will trigger when a SceneObject goes from enabled in the hiearchy to disabled in the hiearchy.

    onEnabled: event0<void>

    An event that will trigger when a SceneObject goes from disabled in the hiearchy to enabled in the hiearchy.

    uniqueIdentifier: string

    Methods

    • Copies component and adds it to the SceneObject, then returns it.

      Type Parameters

      Parameters

      • component: K

      Returns K

    • Creates a shallow copy of the passed in sceneObject (not including its hierarchy), and parents it to this SceneObject.

      Parameters

      Returns SceneObject

    • Creates a deep copy of the passed in sceneObject (including its hierarchy), and parents it to this SceneObject.

      Parameters

      Returns SceneObject

    • Destroys the SceneObject.

      Returns void

    • Returns a list of all components attached to the SceneObject.

      Returns Component[]

    • Returns this SceneObject's child at index index.

      Parameters

      • index: number

      Returns SceneObject

    • Returns the number of children the SceneObject has.

      Returns number

    • Returns the attached component of type componentType at index index. If componentType is an empty string, all component types are considered.

      Type Parameters

      Parameters

      • componentType: K
      • index: number

      Returns ComponentNameMap[K]

    • Returns the number of components of type componentType attached to the SceneObject. If componentType is an empty string, the total number of components attached is returned.

      Type Parameters

      Parameters

      • componentType: K

      Returns number

    • Returns the first attached component of type componentType. If componentType is an empty string, the first component of any type is returned.

      Type Parameters

      Parameters

      • componentType: K

      Returns ComponentNameMap[K]

    • Returns the SceneObject's parent in the hierarchy, or null if there isn't one.

      Returns SceneObject

    • Returns the current render layer of the SceneObject.

      Returns number

    • Returns the Transform attached to the SceneObject.

      Returns Transform

    • Returns whether the SceneObject has a parent in the scene hierarchy.

      Returns boolean

    • Returns true if the object matches or derives from the passed in type.

      Parameters

      • type: string

      Returns boolean

    • Unparents the SceneObject in the hierarchy, making it an orphan.

      Returns void

    • Sets the SceneObject's parent to newParent in the scene hierarchy.

      Parameters

      Returns void

    • Changes the parent of the SceneObject without altering its world position, rotation, or scale.

      Parameters

      Returns void

    • Sets the render layer of the SceneObject to id.

      Parameters

      • id: number

      Returns void

    MMNEPVFCICPMFPCPTTAAATR