A handle to manipulate child objects of this item.

Hierarchy

  • SubNode

Properties

name: string

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

Example

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 undefined | boolean

  • 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

    Current position (Global coordinates)

    Returns null | Vector3

  • 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

    Current rotation (Global coordinates)

    Returns null | Quaternion

  • 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

    Current position (local coordinates of the item)

    Returns undefined | Vector3

  • 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

    Current rotation (local coordinates of the item)

    Returns undefined | Quaternion

  • 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 undefined | boolean

  • Beta

    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.

    Returns

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

    Parameters

    • type: string

    Returns null | UnityComponent

  • 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.

    Example

    subNode.setTextAlignment(TextAlignment.Left);
    

    Parameters

    Returns void

  • 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.

    Example

    subNode.setTextAnchor(TextAnchor.UpperLeft);
    

    Parameters

    Returns void

  • Specify the font color of the SubNode's text display. Each of the RGBA values can be a number between 0 and 1. The color space is sRGB (Gamma). 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. size can be a number between 0 and 5. Values outside of this range will be clamped to the nearest valid value. 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

Generated using TypeDoc