MovePolicy

class MovePolicy : DragPolicy


Defines the movement policy for a spatial object.

This class configures how a spatial object can be moved by user interaction or programmatic changes. It provides options for enabling/disabling movement, controlling "stickiness" to its current pose, and defining callbacks for various stages of the move operation.

Summary

Public constructors

MovePolicy(
    isEnabled: Boolean,
    isStickyPose: Boolean,
    shouldScaleWithDistance: Boolean,
    onMoveStart: ((SpatialMoveStartEvent) -> Unit)?,
    onMoveEnd: ((SpatialMoveEndEvent) -> Unit)?,
    onMove: ((SpatialMoveEvent) -> Boolean)?
)

Public functions

open operator Boolean
equals(other: Any?)
open Int
open String

Public properties

Boolean

Whether movement is enabled for this object.

Boolean

If true, the object will attempt to maintain its relative position and orientation to the user's view or the environment when moved, making it feel "sticky." If false, movement will be more direct.

((SpatialMoveEvent) -> Boolean)?

A callback function invoked repeatedly during a move operation.

((SpatialMoveEndEvent) -> Unit)?

A callback function invoked when a move operation ends.

((SpatialMoveStartEvent) -> Unit)?

A callback function invoked when a move operation begins.

Boolean

If true, the object's perceived size will scale with its distance from the user during movement, giving an illusion of constant visual size.

Public constructors

MovePolicy

Added in 1.0.0-alpha07
MovePolicy(
    isEnabled: Boolean = true,
    isStickyPose: Boolean = false,
    shouldScaleWithDistance: Boolean = true,
    onMoveStart: ((SpatialMoveStartEvent) -> Unit)? = null,
    onMoveEnd: ((SpatialMoveEndEvent) -> Unit)? = null,
    onMove: ((SpatialMoveEvent) -> Boolean)? = null
)

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

toString

open fun toString(): String

Public properties

isEnabled

Added in 1.0.0-alpha07
val isEnabledBoolean

Whether movement is enabled for this object. If false, the object cannot be moved. Defaults to true.

isStickyPose

Added in 1.0.0-alpha07
val isStickyPoseBoolean

If true, the object will attempt to maintain its relative position and orientation to the user's view or the environment when moved, making it feel "sticky." If false, movement will be more direct. Defaults to false.

onMove

Added in 1.0.0-alpha07
val onMove: ((SpatialMoveEvent) -> Boolean)?

A callback function invoked repeatedly during a move operation. It receives a SpatialMoveEvent with current move details and should return true to indicate the move should continue, or false to cancel it. Defaults to null.

onMoveEnd

Added in 1.0.0-alpha07
val onMoveEnd: ((SpatialMoveEndEvent) -> Unit)?

A callback function invoked when a move operation ends. It receives a SpatialMoveEndEvent providing final move details. Defaults to null.

onMoveStart

Added in 1.0.0-alpha07
val onMoveStart: ((SpatialMoveStartEvent) -> Unit)?

A callback function invoked when a move operation begins. It receives a SpatialMoveStartEvent providing initial move details. Defaults to null.

shouldScaleWithDistance

Added in 1.0.0-alpha07
val shouldScaleWithDistanceBoolean

If true, the object's perceived size will scale with its distance from the user during movement, giving an illusion of constant visual size. If false, its physical size remains constant. Defaults to true.