DeepAR Scripting API v5.6.12

Class: Node

Node(viewIdopt, nameopt)

Represents a node in the effect scene.

Constructor

new Node(viewIdopt, nameopt)

Constructs an empty node.
Parameters:
Name Type Attributes Default Description
viewId uint <optional>
2 View ID of the node.
name string <optional>
'' Name of the node

Members

(static, readonly) current :Node

The node on which the script component executing this script is attached.
Type:

(static, readonly) root :Node

The root node of the effect scene.
Type:

animationEnabled :bool

Enables or disables the node animation.
Type:
  • bool

(readonly) childrenCount :uint

Number of node children.
Type:
  • uint

enabled :bool

Enables or disables the node.
Type:
  • bool

eulerAngles :Vector3

Global Euler angles (in radians) of the node.
Type:

(readonly) facePositionComponent :FacePositionComponent

Face Position component.
Type:

(readonly) hasParent :bool

Checks whether the node has a parent or not.
Type:
  • bool

localEulerAngles :Vector3

Local Euler angles (in radians) of the node (relative to its parent).
Type:

localPosition :Vector3

Local position of the node (relative to its parent).
Type:

localQuaternion :Vector4

Local quaternion of the node (relative to its parent).
Type:

localScale :Vector3

Local scale of the node (relative to its parent).
Type:

name :string

Name of the node
Type:
  • string

parent :Node

Parent of the node.
Type:

position :Vector3

Global position of the node.
Type:

(readonly) positionOnScreen :Vector2

Position on the screen render context space.
Type:
See:

quaternion :Vector4

Global quaternion of the node.
Type:

scale :Vector3

Global scale of the node.
Type:

viewId :uint

View ID of the node.
Type:
  • uint

Methods

addChild(child)

Adds a child node to the node instance. If a child already has a parent, it will be unparented first.
Parameters:
Name Type Description
child Node Child node.

drawExplicitly()

Explicitly issues a draw call for the node instance.

equals(node) → {bool}

Checks whether the node instances are same.
Parameters:
Name Type Description
node Node Node instance.
Returns:
True if same, false otherwise.
Type
bool

getChild(param) → {Node}

Gets the child node by index or name.
Parameters:
Name Type Description
param uint | string Child node index or child node name.
Returns:
Child node.
Type
Node

hasFacePositionComponent() → {bool}

Checks whether the node has a Face Position component.
Returns:
True if the node has a Face Position component, false otherwise.
Type
bool

performRayCasting(screenCoordinatesopt, shouldPerformRecursivelyopt)

Performs ray casting for the node instance.
Parameters:
Name Type Attributes Description
screenCoordinates Vector2 <optional>
Screen position from which the ray should be cast.
shouldPerformRecursively bool <optional>
Whether the intersection checking should be performed on the descendants of the node instance.

removeChild(param)

Removes a child node from the node instance.
Parameters:
Name Type Description
param uint | string | Node Child node index, child node name or child node.

removeFromParent()

Removes the node from its parent.

toString() → {string}

Gets the string representation of the node.
Returns:
Node string representation.
Type
string
Examples
// Outputs '[Node ""]' to the debug console.
var node = new Node();
Debug.log(node.toString());
// Outputs '[Node "node_234"]' to the debug console.
var node = new Node(2, 'node_234');
Debug.log(node.toString());