/* * SPDX-License-Identifier: AGPL-3.0-or-later * Copyright (C) 2025 Sergej Görzen * This file is part of OmiLAXR. */ using System.ComponentModel; using OmiLAXR.Types; using UnityEngine; namespace OmiLAXR.TrackingBehaviours.Learner { /// /// Base class for tracking teleportation events in VR environments. /// Captures teleportation start/end states and target information. /// [AddComponentMenu("OmiLAXR / 3) Tracking Behaviours / Teleportation Tracking Behaviour"), Description("Tracks teleportation events of , and components.")] public abstract class TeleportationTrackingBehaviour : TrackingBehaviour { /// /// Represents the player's state at a specific moment during teleportation. /// public struct TeleportationPlayerState { /// /// Floor position of the player. /// public Vector3 FloorPosition; /// /// Direction the camera is facing. /// public Vector3 CameraGazeDirection; } /// /// Types of teleportation targets available in the system. /// public enum TeleportationTargetType { Floor, Anchor, Area, Object, Custom } /// /// Complete teleportation event data including states, target, and timing information. /// public struct TeleportationArgs { /// /// Y-axis offset of the camera from floor position. /// public float CameraYOffset; /// /// Player state before teleportation. /// public TeleportationPlayerState StartState; /// /// Player state after teleportation. /// public TeleportationPlayerState EndState; /// /// The target GameObject for the teleportation. /// public GameObject Target; /// /// Type of teleportation target. /// public TeleportationTargetType TargetType; /// /// Final destination position. /// public Vector3 DestinationPosition; /// /// Final destination rotation. /// public Vector3 DestinationRotation; /// /// Time when teleportation was requested. /// public float RequestTime; /// /// Hand used to initiate teleportation. /// public Hand Hand; /// /// Creates teleportation event data with all necessary information. /// public TeleportationArgs(GameObject target, TeleportationTargetType targetType, float cameraYOffset, TeleportationPlayerState startState, TeleportationPlayerState endState, Vector3? destinationPosition = null, Vector3? destinationRotation = null, Hand hand = Hand.Unknown) { Target = target; Hand = hand; TargetType = targetType; CameraYOffset = cameraYOffset; StartState = startState; EndState = endState; DestinationPosition = destinationPosition ?? Vector3.zero; DestinationRotation = destinationRotation ?? Vector3.zero; RequestTime = 0.0f; } } /// /// Event triggered when a teleportation occurs. /// [Gesture("XRController"), Action("Teleport")] public readonly TrackingBehaviourEvent OnTeleported = new TrackingBehaviourEvent(); } }