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 "soft", which gradually catches up to the target.

Summary

Constants

const Int
const Long

Public companion functions

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

Creates a behavior where the content smoothly animates to follow the user's movements, creating a comfortable "soft 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_SOFT_DURATION_MS

const val DEFAULT_SOFT_DURATION_MS = 1500: Int

MIN_SOFT_DURATION_MS

const val MIN_SOFT_DURATION_MS = 100: Long

Public companion functions

soft

Added in 1.0.0-alpha10
fun soft(durationMs: @IntRange(from = 100) Int = DEFAULT_SOFT_DURATION_MS): LockingBehavior

Creates a behavior where the content smoothly animates to follow the user's movements, creating a comfortable "soft 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_SOFT_DURATION_MS

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

Returns
LockingBehavior

A LockingBehavior instance configured for soft locking.

static

Added in 1.0.0-alpha10
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-alpha10
protected var targetCurrentPosePose