public class ARNode

  1. Object
  2. ARNode

A node in the small scene graph rendered at an ARAnchor. A node carries an optional ARModel plus a local transform relative to its parent (or to the anchor for the root node), and may hold child nodes.

Attach a root node to an anchor with ARAnchor#setNode(ARNode). After attachment, transform and visibility changes are forwarded to the platform renderer automatically. Mutate nodes on the EDT.

Constructors

public ARNode()Creates an empty grouping node with no geometry of its own.
public ARNode(ARModel model)Creates a node rendering the supplied model.

Methods

public ARModel getModel()The model rendered at this node, or null for a grouping node.
public ARNode setLocalPosition(float x, float y, float z)Sets the node position relative to its parent (or the anchor for a root node), in meters.
public ARNode setLocalRotation(float qx, float qy, float qz, float qw)Sets the node rotation relative to its parent as a quaternion.
public ARNode setLocalScale(float scale)Sets a uniform scale factor relative to the parent.
public ARNode setVisible(boolean visible)Shows or hides this node and its children.
public float getLocalX()The local X position in meters.
public float getLocalY()The local Y position in meters.
public float getLocalZ()The local Z position in meters.
public float getLocalQx()The X component of the local rotation quaternion.
public float getLocalQy()The Y component of the local rotation quaternion.
public float getLocalQz()The Z component of the local rotation quaternion.
public float getLocalQw()The W component of the local rotation quaternion.
public float getLocalScale()The uniform local scale factor.
public boolean isVisible()True when this node (and therefore its children) is rendered.
public void addChild(ARNode child)Adds a child node.
public void removeChild(ARNode child)Removes a child node.
public int getChildCount()The number of child nodes.
public ARNode getChildAt(int index)The child node at the supplied index.
public ARNode getParent()The parent node, or null for a root node.

Inherited methods

Constructor details

ARNode

public ARNode()
Creates an empty grouping node with no geometry of its own.

ARNode

public ARNode(ARModel model)
Creates a node rendering the supplied model.

Parameters

model ARModel
the content to render at this node

Method details

getModel

public ARModel getModel()
The model rendered at this node, or null for a grouping node.

setLocalPosition

public ARNode setLocalPosition(float x, float y, float z)
Sets the node position relative to its parent (or the anchor for a root node), in meters.

setLocalRotation

public ARNode setLocalRotation(float qx, float qy, float qz, float qw)
Sets the node rotation relative to its parent as a quaternion.

setLocalScale

public ARNode setLocalScale(float scale)
Sets a uniform scale factor relative to the parent. Default 1.

setVisible

public ARNode setVisible(boolean visible)
Shows or hides this node and its children. Default visible.

getLocalX

public float getLocalX()
The local X position in meters.

getLocalY

public float getLocalY()
The local Y position in meters.

getLocalZ

public float getLocalZ()
The local Z position in meters.

getLocalQx

public float getLocalQx()
The X component of the local rotation quaternion.

getLocalQy

public float getLocalQy()
The Y component of the local rotation quaternion.

getLocalQz

public float getLocalQz()
The Z component of the local rotation quaternion.

getLocalQw

public float getLocalQw()
The W component of the local rotation quaternion.

getLocalScale

public float getLocalScale()
The uniform local scale factor.

isVisible

public boolean isVisible()
True when this node (and therefore its children) is rendered.

addChild

public void addChild(ARNode child)
Adds a child node. A node may have at most one parent.

Parameters

child ARNode
the node to add below this one

removeChild

public void removeChild(ARNode child)
Removes a child node. No-op when the node is not a child of this one.

Parameters

child ARNode
the node to remove

getChildCount

public int getChildCount()
The number of child nodes.

getChildAt

public ARNode getChildAt(int index)
The child node at the supplied index.

getParent

public ARNode getParent()
The parent node, or null for a root node.