Page Summary
-
AnchorNodeautomatically positions itself in the world based on an ARCore Anchor, disabling children when the anchor isn't tracking. -
It provides methods to get/set the ARCore anchor, control smoothing of transitions, and check tracking status.
-
When not anchored,
AnchorNodeallows manipulation of its local and world position and rotation. -
If an anchor is set, calls to set local/world position/rotation on the
AnchorNodewill be ignored. -
All child nodes of an
AnchorNodewill be disabled if the associated anchor is not in the TRACKING state.
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.
|
|
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 | |
| void | |
| void | |
| 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 | |
| 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 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. |
|---|