The initial pose (init pose) defines the spatial relationship between the camera and the tracked object at which tracking should start. Tracking will initialize (i.e., "snap on" to the real object) when the camera is navigated to the init pose relative to the real object.
You can either define the init pose in the tracking configuration, or set it from inside Unity.
In Unity, the init pose is defined by the relative pose between a TrackingAnchor
and its corresponding SLAM Camera
GameObject
. Therefore you can adjust it by moving the TrackingAnchor
, the Camera
, or both. In order to find an appropriate init position, you should first add the model you want to track as a child of a TrackingAnchor
. Then, make sure that the model is visible in Unity. This can be achieved by pressing the Make all models visible in the game view
button on the TrackingAnchor
in the Tracking Geometry
section.
After this, you can obtain a good first estimation of the init pose by pressing Center in Slam Camera
in the TrackingAnchor
. Pressing this button will move the TrackingAnchor
to a position where it is fully visible in the Game
view window. It will also adjust the near
and far
plane of the selected camera if this is required to keep the model entirely visible.
Continue adjusting the TrackingAnchor's
pose until you have found a satisfactory initial pose. You can then hide the model again.
Note: Depending on the camera calibration, the model may appear closer in the application after starting the tracking than in the game view in edit mode. Therefore we recommend using an init pose where the model is somewhat further away from the camera than would seem ideal in edit mode. For further information on this topic, see Camera Calibration.
You can avoid this issue by adding an InitPoseInteraction
-component to the affected TrackingAnchor
via the Add Init Pose Interaction
button in the Augmented Content
section (see image below). This will allow you to modify the init pose via mouse/touch inputs at runtime.
Pressing this button will add a GameObjectPoseInteraction
component and an InitPoseInteraction
component. They are both necessary for adjusting the init pose of the TrackingAnchor
at runtime.
The GameObjectPoseInteraction
enables modifications of its GameObject's
Transform
. It allows you to rotate and pan the object, as well as to zoom, i.e. to move the GameObject
closer/further away from the rendering camera. As these interactions only make sense in relation to a Camera
, the GameObjectPoseInteraction
requires a reference to the GameViewCamera
. This is the camera actively rendering your scene at any given time. By default, the GameViewCamera
is set to Camera.main
. The Interaction Type
specifies whether the interaction should consider all inputs in the Game
window (Always
) or only consider inputs made while the finger or cursor touches the GameObject
in the game view (When Game Object selected
). If you have multiple models with GameObjectPoseInteractions
in your scene, we recommend using When Game Object selected
. This allows you to adjust the pose of a single GameObject
without affecting other GameObjects
.
There is a variety of additional settings for fine tuning the GameObjectPoseInteraction's
response to inputs. Adjusting them isn't necessary in most cases. They are therefore not described in detail here.
The InitPoseInteraction
propagates the interaction-based Transform
changes to the TrackingAnchor
, ensuring they are interpreted correctly as modifications to the init pose.
The GameObjectPoseInteraction
modifies the Transform
of the GameObject
in play mode. These modifications will get lost when exiting play mode. To save the transformation persistently follow these steps:
Transform
components values. Transform
. TrackingAnchor's
SLAM Camera
GameObject
. Reset all values of this GameObject's
Transform
to 0.