LockingBehavior

@ExperimentalUserSubspaceApi
abstract class LockingBehavior


A LockingBehavior controls the motion of content as it is following (or "locked" to) another entity, such as a user's head. Currently the options include "static", which does not continuously follow the target, and "lazy", which gradually catches up to the target.

Summary

Constants

const Int
const Long

Public companion functions

LockingBehavior
lazy(durationMs: @IntRange(from = 100) Int)

Creates a behavior where the content smoothly animates to follow the user's movements, creating a comfortable "lazy follow" effect.

LockingBehavior

The content is placed once based on the user's initial pose and does not follow subsequent movements.

Protected properties

Pose

Constants

DEFAULT_LAZY_DURATION_MS

const val DEFAULT_LAZY_DURATION_MS = 1500: Int

MIN_LAZY_DURATION_MS

const val MIN_LAZY_DURATION_MS = 100: Long

Public companion functions

lazy

Added in 1.0.0-alpha09
fun lazy(durationMs: @IntRange(from = 100) Int = DEFAULT_LAZY_DURATION_MS): LockingBehavior

Creates a behavior where the content smoothly animates to follow the user's movements, creating a comfortable "lazy follow" effect. This is implemented with the Hermite easing algorithm, which accelerates the content then slows it down towards the end of the motion, giving it a sense of real world physics. The use of the Hermite algorithm is not optional but the total duration of the motion can be modified.

Parameters
durationMs: @IntRange(from = 100) Int = DEFAULT_LAZY_DURATION_MS

Amount of milliseconds it takes for the content to catch up to the user. Default is DEFAULT_LAZY_DURATION_MS milliseconds. A value less than MIN_LAZY_DURATION_MS will be rounded up to MIN_LAZY_DURATION_MS to allow enough time to complete the content movement.

Returns
LockingBehavior

A LockingBehavior instance configured for lazy locking.

static

Added in 1.0.0-alpha09
fun static(): LockingBehavior

The content is placed once based on the user's initial pose and does not follow subsequent movements.

Protected properties

targetCurrentPose

Added in 1.0.0-alpha09
protected var targetCurrentPosePose