ARVRAnchor

Refreshing Cache...

Inherits: Spatial < Node < Object

An anchor point in AR space.

Description

The ARVRAnchor point is a spatial node that maps a real world location identified by the AR platform to a position within the game world. For example, as long as plane detection in ARKit is on, ARKit will identify and update the position of planes (tables, floors, etc) and create anchors for them.

This node is mapped to one of the anchors through its unique ID. When you receive a signal that a new anchor is available, you should add this node to your scene for that anchor. You can predefine nodes and set the ID; the nodes will simply remain on 0,0,0 until a plane is recognized.

Keep in mind that, as long as plane detection is enabled, the size, placing and orientation of an anchor will be updated as the detection logic learns more about the real world out there especially if only part of the surface is in view.

Properties

intanchor_id1

Methods

Stringget_anchor_name ( ) const
boolget_is_active ( ) const
Meshget_mesh ( ) const
Planeget_plane ( ) const
Vector3get_size ( ) const

Signals

  • mesh_updated ( Mesh mesh )

Emitted when the mesh associated with the anchor changes or when one becomes available. This is especially important for topology that is constantly being mesh_updated.

Property Descriptions

Default1
Setterset_anchor_id(value)
Getterget_anchor_id()

The anchor’s ID. You can set this before the anchor itself exists. The first anchor gets an ID of 1, the second an ID of 2, etc. When anchors get removed, the engine can then assign the corresponding ID to new anchors. The most common situation where anchors “disappear” is when the AR server identifies that two anchors represent different parts of the same plane and merges them.

Method Descriptions

  • String get_anchor_name ( ) const

Returns the name given to this anchor.


  • bool get_is_active ( ) const

Returns true if the anchor is being tracked and false if no anchor with this ID is currently known.


  • Mesh get_mesh ( ) const

If provided by the ARVRInterface, this returns a mesh object for the anchor. For an anchor, this can be a shape related to the object being tracked or it can be a mesh that provides topology related to the anchor and can be used to create shadows/reflections on surfaces or for generating collision shapes.


  • Plane get_plane ( ) const

Returns a plane aligned with our anchor; handy for intersection testing.


Returns the estimated size of the plane that was detected. Say when the anchor relates to a table in the real world, this is the estimated size of the surface of that table.

doradoro's advice! Getters and Setters will be deprecated! Avoid their use!

Disclaimer: This page has been automaticaly and directly extracted from the official Godot Docs website, the 2020-03-07 at 01:28:50. It's the English Stable version because it's what most Godot users should use. The Copyright owners are Juan Linietsky, Ariel Manzur and the Godot community. CC-BY 3.0. Thanks for your patience and generosity.