ArInstantPlacementPoint
Trackable Instant Placement point returned by ArFrame_hitTestInstantPlacement
.
If ARCore has an accurate 3D pose for the ArInstantPlacementPoint
returned by ArFrame_hitTestInstantPlacement
it will start with tracking method AR_INSTANT_PLACEMENT_POINT_TRACKING_METHOD_FULL_TRACKING
. Otherwise, it will start with tracking method AR_INSTANT_PLACEMENT_POINT_TRACKING_METHOD_SCREENSPACE_WITH_APPROXIMATE_DISTANCE
, and will transition to AR_INSTANT_PLACEMENT_POINT_TRACKING_METHOD_FULL_TRACKING
once ARCore has an accurate 3D pose. Once the tracking method is AR_INSTANT_PLACEMENT_POINT_TRACKING_METHOD_FULL_TRACKING
it will not revert to AR_INSTANT_PLACEMENT_POINT_TRACKING_METHOD_SCREENSPACE_WITH_APPROXIMATE_DISTANCE
.
When the tracking method changes from AR_INSTANT_PLACEMENT_POINT_TRACKING_METHOD_SCREENSPACE_WITH_APPROXIMATE_DISTANCE
in one frame to AR_INSTANT_PLACEMENT_POINT_TRACKING_METHOD_FULL_TRACKING
in the next frame, the pose will jump from its initial location based on the provided approximate distance to a new location at an accurate distance.
This instantaneous change in pose will change the apparent scale of any objects that are anchored to the ArInstantPlacementPoint
. That is, an object will suddenly appear larger or smaller than it was in the previous frame.
To avoid the visual jump due to the sudden change in apparent object scale, use the following procedure:
- Keep track of the pose and tracking method of the
ArInstantPlacementPoint
in each frame. - Wait for the tracking method to change to
AR_INSTANT_PLACEMENT_POINT_TRACKING_METHOD_FULL_TRACKING
. - Use the pose from the previous frame and the pose in the current frame to determine the object's distance to the device in both frames.
- Calculate the apparent change in scale due to the change in distance from the camera.
- Adjust the scale of the object to counteract the perceived change in scale, so that visually the object does not appear to change in size.
- Optionally, smoothly adjust the scale of the object back to its original value over several frames.
Summary
Enumerations
ArInstantPlacementMode
{
AR_INSTANT_PLACEMENT_MODE_DISABLED
= 0,
AR_INSTANT_PLACEMENT_MODE_LOCAL_Y_UP
= 2
}
Typedefs
Functions
ArInstantPlacementPoint_getPose
(const ArSession
*session, const ArInstantPlacementPoint
*instant_placement_point, ArPose
*out_pose)
void
ArInstantPlacementPoint_getTrackingMethod
(const ArSession
*session, const ArInstantPlacementPoint
*instant_placement_point, ArInstantPlacementPointTrackingMethod
*out_tracking_method)
void
Enumerations
ArInstantPlacementMode
ArInstantPlacementMode
Used in ArConfig
to indicate whether Instant Placement should be enabled or disabled.
Default value is AR_INSTANT_PLACEMENT_MODE_DISABLED
.
Instant Placement is disabled.
When Instant Placement is disabled, any ArInstantPlacementPoint
that has AR_INSTANT_PLACEMENT_POINT_TRACKING_METHOD_SCREENSPACE_WITH_APPROXIMATE_DISTANCE
tracking method will result in tracking state becoming permanently AR_TRACKING_STATE_STOPPED
.
Enable Instant Placement.
If the hit test is successful, ArFrame_hitTestInstantPlacement
will return a single ArInstantPlacementPoint
with the +Y pointing upward, against gravity. Otherwise, returns an empty result set.
This mode is currently intended to be used with hit tests against horizontal surfaces.
Hit tests may also be performed against surfaces with any orientation, however:
- The resulting Instant Placement point will always have a pose with +Y pointing upward, against gravity.
- No guarantees are made with respect to orientation of +X and +Z. Specifically, a hit test against a vertical surface, such as a wall, will not result in a pose that's in any way aligned to the plane of the wall, other than +Y being up, against gravity.
- The
ArInstantPlacementPoint 's
tracking method may never becomeAR_INSTANT_PLACEMENT_POINT_TRACKING_METHOD_FULL_TRACKING
or may take a long time to reach this state. The tracking method remainsAR_INSTANT_PLACEMENT_POINT_TRACKING_METHOD_SCREENSPACE_WITH_APPROXIMATE_DISTANCE
. until a (tiny) horizontal plane is fitted at the point of the hit test.
ArInstantPlacementPointTrackingMethod
ArInstantPlacementPointTrackingMethod
Tracking methods for ArInstantPlacementPoint
.
The ArInstantPlacementPoint
is being tracked normally and ArInstantPlacementPoint_getPose
is using a pose fully determined by ARCore.
ARCore doesn't limit the number of Instant Placement points with AR_INSTANT_PLACEMENT_POINT_TRACKING_METHOD_FULL_TRACKING
that are being tracked concurrently.
The ArInstantPlacementPoint
is not currently being tracked.
The ArTrackingState
is AR_TRACKING_STATE_PAUSED
or AR_TRACKING_STATE_STOPPED
.
The ArInstantPlacementPoint
is currently being tracked in screen space and the pose returned by ArInstantPlacementPoint_getPose
is being estimated using the approximate distance provided to ArFrame_hitTestInstantPlacement
.
ARCore concurrently tracks at most 20 Instant Placement points that are AR_INSTANT_PLACEMENT_POINT_TRACKING_METHOD_SCREENSPACE_WITH_APPROXIMATE_DISTANCE
. As additional Instant Placement points with AR_INSTANT_PLACEMENT_POINT_TRACKING_METHOD_SCREENSPACE_WITH_APPROXIMATE_DISTANCE
are created, the oldest points will become permanently AR_TRACKING_STATE_STOPPED
in order to maintain the maximum number of concurrently tracked points.
Typedefs
ArInstantPlacementPoint
struct ArInstantPlacementPoint_ ArInstantPlacementPoint
( reference type, long-lived ).
- Trackable type:
AR_TRACKABLE_INSTANT_PLACEMENT_POINT
- Release with:
ArTrackable_release
Functions
ArInstantPlacementPoint_getPose
void ArInstantPlacementPoint_getPose ( const ArSession * session , const ArInstantPlacementPoint * instant_placement_point , ArPose * out_pose )
Returns the pose of the ArInstantPlacementPoint
.
session
|
The ARCore session.
|
instant_placement_point
|
The Instant Placement point to retrieve the pose of.
|
out_pose
|
ArInstantPlacementPoint_getTrackingMethod
void ArInstantPlacementPoint_getTrackingMethod ( const ArSession * session , const ArInstantPlacementPoint * instant_placement_point , ArInstantPlacementPointTrackingMethod * out_tracking_method )
Returns the tracking method of the ArInstantPlacementPoint
.
session
|
The ARCore session.
|
instant_placement_point
|
The Instant Placement point to retrieve the tracking method of.
|
out_tracking_method
|
An already-allocated
ArInstantPlacementPointTrackingMethod
object into which the tracking method will be stored. |