Cluster Creator Kit Script Reference
    Preparing search index...

    Interface SubNodeItem

    A handle to manipulate child objects of this item.

    interface SubNode {
        name: string;
        getEnabled(): boolean | undefined;
        getGlobalPosition(): Vector3 | null;
        getGlobalRotation(): Quaternion | null;
        getPosition(): Vector3 | undefined;
        getRotation(): Quaternion | undefined;
        getTotalEnabled(): boolean | undefined;
        getUnityComponent(type: string): UnityComponent | null;
        setEnabled(v: boolean): void;
        setPosition(pos: Vector3): void;
        setRotation(rot: Quaternion): void;
        setText(text: string): void;
        setTextAlignment(alignment: TextAlignment): void;
        setTextAnchor(anchor: TextAnchor): void;
        setTextColor(r: number, g: number, b: number, a: number): void;
        setTextSize(size: number): void;
    }
    Index

    Properties

    name: string

    The name of the SubNode object. It is the same as the subNodeName specified in ClusterScript.subNode.

    let subNode = $.subNode("MySubNode");
    $.log(subNode.name); // => MySubNode

    Methods

    • Obtains the Enabled state of the SubNode.

      If you call this immediately after calling setEnabled, please be aware it will return the SubNode's current Enabled state, not the state passed to setEnabled.

      If the value cannot be obtained, this method will return undefined.

      Returns boolean | undefined

    • Obtains the current position. If you call this immediately after calling setPosition, please be aware it will return the SubNode's current position, not the value passed to setPosition.

      If the value cannot be obtained, this method will return null.

      Returns Vector3 | null

      Current position (Global coordinates)

    • Obtains the current rotation. If you call this immediately after calling setRotation, please be aware it will return the SubNode's current rotation, not the value passed to setRotation.

      If the value cannot be obtained, this method will return null.

      Returns Quaternion | null

      Current rotation (Global coordinates)

    • Obtains the current position of the SubNode. If you call this immediately after calling setPosition, please be aware it will return the SubNode's current position, not the value passed to setPosition.

      If the value cannot be obtained, this method will return undefined.

      Returns Vector3 | undefined

      Current position (local coordinates of the item)

    • Obtains the current rotation of the SubNode. If you call this immediately after calling setRotation, please be aware it will return the SubNode's current rotation, not the value passed to setRotation.

      If the value cannot be obtained, this method will return undefined.

      Returns Quaternion | undefined

      Current rotation (local coordinates of the item)

    • Obtains whether the SubNode is treated as Enabled in the space. A SubNode is treated as Enabled in the space only when the SubNode, and all of its parents, are Enabled.

      If you call this immediately after calling setEnabled, please be aware it will return the SubNode's current Enabled state, not the state passed to setEnabled.

      If the value cannot be obtained, this method will return undefined.

      Returns boolean | undefined

    • Gets the handle of the Unity component attached to this object by type name. The available type names are defined in UnityComponent.

      If the object has multiple components, returns first component.

      This API is only available for worlds uploaded from the Creator Kit. This API is not available from Craft Items.

      Parameters

      • type: string

      Returns UnityComponent | null

      The component specified by type name, or null if not found

    • Modifies the Enabled state of the SubNode. A disabled SubNode and all of its children will be treated as disabled in the space. It will not be displayed, and will be excluded from collision detection.

      As the Enabled state is synced across the network, please be aware it may not be reflected immediately.

      Parameters

      • v: boolean

        true if Enabled

      Returns void

    • Specify a position to move the SubNode to. As the positions are interpolated and synced across the network, please be aware they may not be reflected immediately.

      Parameters

      • pos: Vector3

        Target position (local coordinates of the item)

      Returns void

    • Specify a rotation to rotate the SubNode to. As the rotations are interpolated and synced across the network, please be aware they may not be reflected immediately.

      Parameters

      • rot: Quaternion

        Target rotation (local coordinates of the item)

      Returns void

    • Specify a text string for the SubNode's text display. Line breaks can be used by entering \n. The string must be 1 KB or less in size. If the string exceeds 1 KB, this method will fail with a ClusterScriptError (requestSizeLimitExceeded) error. If the SubNode does not have a TextView attached, nothing will happen.

      For details on TextView, refer to the documentation.

      Parameters

      • text: string

      Returns void

    • Specify the horizontal text alignment (if the text contains line breaks) of the SubNode's text display. If the SubNode does not have a TextView attached, nothing will happen.

      For details on TextView, refer to the documentation.

      Parameters

      Returns void

      subNode.setTextAlignment(TextAlignment.Left);
      
    • Specify the anchor position of the SubNode's text display. eg. When set to UpperLeft, the upper left corner of the text display will match the SubNode's position. If the SubNode does not have a TextView attached, nothing will happen.

      For details on TextView, refer to the documentation.

      Parameters

      Returns void

      subNode.setTextAnchor(TextAnchor.UpperLeft);
      
    • Specify the font color of the SubNode's text display.

      The value passed to this method is treated as a value in the sRGB color space. Each specified RGBA value is clamped between 0 and 1. If the SubNode does not have a TextView attached, nothing will happen.

      For details on TextView, refer to the documentation.

      Parameters

      • r: number

        Red value

      • g: number

        Green value

      • b: number

        Blue value

      • a: number

        Alpha value (will be transparent when 0)

      Returns void

    • Specify the font size for the SubNode's text display. The size is clamped between 0 and 5. The final display size of the text depends on both the size value set here, and the global scale of the SubNode. When the global scale of the SubNode is 1 and size is set to 1, the x-height of the text will be approximately 1 meter tall. If the SubNode does not have a TextView attached, nothing will happen.

      For details on TextView, refer to the documentation.

      Parameters

      • size: number

      Returns void