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: ((SpatialMoveEvent) -> Unit)?,
    onMoveEnd: ((SpatialMoveEvent) -> Unit)?,
    onMove: ((SpatialMoveEvent) -> Boolean)?
)

This function is deprecated. Use SubspaceModifier.movable() instead.

Public functions

open operator Boolean
equals(other: Any?)

This function is deprecated. Use SubspaceModifier.movable() instead.

open Int

This function is deprecated. Use SubspaceModifier.movable() instead.

open String

This function is deprecated. Use SubspaceModifier.movable() instead.

Public properties

Boolean

This property is deprecated. Use SubspaceModifier.movable() instead.

Boolean

This property is deprecated. Use SubspaceModifier.movable() instead.

((SpatialMoveEvent) -> Boolean)?

This property is deprecated. Use SubspaceModifier.movable() instead.

((SpatialMoveEvent) -> Unit)?

This property is deprecated. Use SubspaceModifier.movable() instead.

((SpatialMoveEvent) -> Unit)?

This property is deprecated. Use SubspaceModifier.movable() instead.

Boolean

This property is deprecated. Use SubspaceModifier.movable() instead.

Public constructors

MovePolicy

Added in 1.0.0-alpha13
Deprecated in 1.0.0-alpha13
MovePolicy(
    isEnabled: Boolean = true,
    isStickyPose: Boolean = false,
    shouldScaleWithDistance: Boolean = true,
    onMoveStart: ((SpatialMoveEvent) -> Unit)? = null,
    onMoveEnd: ((SpatialMoveEvent) -> 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-alpha13
Deprecated in 1.0.0-alpha13
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-alpha13
Deprecated in 1.0.0-alpha13
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-alpha13
Deprecated in 1.0.0-alpha13
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-alpha13
Deprecated in 1.0.0-alpha13
val onMoveEnd: ((SpatialMoveEvent) -> Unit)?

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

onMoveStart

Added in 1.0.0-alpha13
Deprecated in 1.0.0-alpha13
val onMoveStart: ((SpatialMoveEvent) -> Unit)?

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

shouldScaleWithDistance

Added in 1.0.0-alpha13
Deprecated in 1.0.0-alpha13
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.