# Class ARNode

java.lang.Object
com.codename1.ar.ARNode

public class ARNode extends Object

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.

- ## Constructor Summary

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

- ## Method Summary

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

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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`: 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`: 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`: 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.