public abstract class FollowMode internal constructor()
A FollowMode controls the motion of content as it is following another target. Currently, the options include "soft", which gradually catches up to the target and "snap", which does not continuously follow the target.
Members
Companion
public companion object
Functions
snap
public fun snap(dimensions: TrackedDimensions = TrackedDimensions.All): FollowMode
Places content once based on the target's initial pose and does not follow subsequent movements.
Parameters
| dimensions | A set of boolean flags which determine the dimensions of movement that are tracked. By default, all dimensions are tracked. |
tight
public fun tight(dimensions: TrackedDimensions = TrackedDimensions.All): FollowMode
Follows the target as closely as possible.
In contrast to soft, where the content lags behind the target, tight follow matches the target's movement instantly.
Parameters
| dimensions | A set of boolean flags which determine the dimensions of movement that are tracked. By default, all dimensions are tracked. |
soft
public fun soft(
dimensions: TrackedDimensions = TrackedDimensions.All,
@IntRange(from = 1) halfLifeMillis: Long = SoftFollowMode.DEFAULT_HALF_LIFE_MILLIS,
@IntRange(from = 0) startDelay: Long = SoftFollowMode.DEFAULT_START_DELAY,
startThresholds: FollowThresholds = SoftFollowMode.DEFAULT_START_THRESHOLDS,
): FollowMode
Creates a mode where the content smoothly animates to follow the target's movements.
This mode is driven by a first-order exponential decay model, which smoothly decelerates the trailing entity as it approaches the target.
Parameters
| dimensions | A set of boolean flags which determine the dimensions of movement that are tracked. Defaults to TrackedDimensions.All. |
| halfLifeMillis | Time in milliseconds it takes for the content to cover half the distance to the target. Defaults to 175 milliseconds. |
| startDelay | Time in milliseconds to wait before starting the follow movement. Defaults to 200 milliseconds. |
| startThresholds | A set of thresholds that must be exceeded before movement starts. Defaults to 0.2 meters of translation and 16 degrees of pitch, 24 degrees of yaw, and 20 degrees of roll. |
Return
A FollowMode instance configured for soft following.
soft
@Deprecated(
message =
"durationMs is deprecated as follow motion is now based on exponential decay. " +
"Use halfLifeMillis instead.",
replaceWith = ReplaceWith("FollowMode.soft(dimensions = dimensions)"),
)
public fun soft(
@IntRange(from = 100) durationMs: Int,
dimensions: TrackedDimensions = TrackedDimensions.All,
): FollowMode
Creates a mode where the content smoothly animates to follow the target's movements.
Parameters
| durationMs | Amount of milliseconds it takes for the content to catch up to the user. |
| dimensions | A set of boolean flags which determine the dimensions of movement that are tracked. By default, all dimensions are tracked. |
Return
A FollowMode instance configured for soft following.