AnchorNode

public class AnchorNode

Node that is automatically positioned in world space based on an ARCore Anchor.

When the Anchor isn't tracking, all children of this node are disabled.

Public Constructors

AnchorNode()
Create an AnchorNode with no anchor.
AnchorNode(Anchor anchor)
Create an AnchorNode with the specified anchor.

Public Methods

Anchor
getAnchor()
Returns the ARCore anchor if it exists or null otherwise.
boolean
isSmoothed()
Returns true if the transformations are interpolated or false if they are applied immediately.
boolean
isTracking()
Returns true if the ARCore anchor’s tracking state is TRACKING.
void
onUpdate(FrameTime frameTime)
AnchorNode overrides this to update the node's position to match the ARCore Anchor's position.
void
setAnchor(Anchor anchor)
Set an ARCore anchor and force the position of this node to be updated immediately.
void
setLocalPosition(Vector3 position)
Set the local-space position of this node if it is not anchored.
void
setLocalRotation(Quaternion rotation)
Set the local-space rotation of this node if it is not anchored.
void
setSmoothed(boolean smoothed)
Set true to smooth the transition between the node’s current position and the anchor position.
void
setWorldPosition(Vector3 position)
Set the world-space position of this node if it is not anchored.
void
setWorldRotation(Quaternion rotation)
Set the world-space rotation of this node if it is not anchored.

Inherited Methods

Public Constructors

public AnchorNode ()

Create an AnchorNode with no anchor.

public AnchorNode (Anchor anchor)

Create an AnchorNode with the specified anchor.

Parameters
anchor the ARCore anchor that this node will automatically position itself to.

Public Methods

public Anchor getAnchor ()

Returns the ARCore anchor if it exists or null otherwise.

public boolean isSmoothed ()

Returns true if the transformations are interpolated or false if they are applied immediately.

public boolean isTracking ()

Returns true if the ARCore anchor’s tracking state is TRACKING.

public void onUpdate (FrameTime frameTime)

AnchorNode overrides this to update the node's position to match the ARCore Anchor's position.

Parameters
frameTime provides time information for the current frame

public void setAnchor (Anchor anchor)

Set an ARCore anchor and force the position of this node to be updated immediately.

Parameters
anchor the ARCore anchor that this node will automatically position itself to.

public void setLocalPosition (Vector3 position)

Set the local-space position of this node if it is not anchored. If the node is anchored, this call does nothing.

Parameters
position The position to apply.

public void setLocalRotation (Quaternion rotation)

Set the local-space rotation of this node if it is not anchored. If the node is anchored, this call does nothing.

Parameters
rotation The rotation to apply.

public void setSmoothed (boolean smoothed)

Set true to smooth the transition between the node’s current position and the anchor position. Set false to apply transformations immediately. Smoothing is true by default.

Parameters
smoothed Whether the transformations are interpolated.

public void setWorldPosition (Vector3 position)

Set the world-space position of this node if it is not anchored. If the node is anchored, this call does nothing.

Parameters
position The position to apply.

public void setWorldRotation (Quaternion rotation)

Set the world-space rotation of this node if it is not anchored. If the node is anchored, this call does nothing.

Parameters
rotation The rotation to apply.