-
Notifications
You must be signed in to change notification settings - Fork 0
The Session Reference Frame
It is important to understand the difference between ARC session space, AR Foundation session and Unity's world space, and how they work together to bring a multiuser AR experience.
When a Session is created, either automatically or by user confirmation, a GameObject called ARCSessionAnchor is instantiated in Unity world space. Its starting position is the same as the first marker image scanned:
The orientation of ARCSessionAnchor in space is determined as follows. First, the Setup Manager considers all marker positions, and computes the centre of mass:
Then, the ARCSessionAnchor looks towards the centre of mass (Y-coordinate are levelled out):
Finally, an ARAnchor
component is attached to ARCSessionAnchor. This way, the AR Anchor Manager subsystem will update this GameObject, changing its position and rotation in Unity world space to fit the starting pose.
Once the Anchor is in place, the ARC Setup Manager creates a new GameObject: ARCSessionOrigin. This GameObject contains all 3D objects of the shared session: ARC Users, ARC Entities, simple networked objects... It is the Session Reference Frame for 3D content. Its parent is set to be ARCSessionAnchor: every time the ARAnchor
updates, the ARCSessionOrigin moves as well; at the same time, the 3D content can be moved and rotated in the ARCSessionOrigin local space and the Origin itself can be moved and rotated in the ARCSessionAnchor local space.
The ARCSession.Spawn()
function makes sure every object instantiated is parented to ARCSessionOrigin and moves to the desired position and rotation in the Origin local space. Physics raycasts are performed in world coordinates, but ARCSession deals with converting all vector data appropriately.