// -------------------------------------------------------------------------------------------------------------------- // // Copyright (c) VRMADA, All rights reserved. // // -------------------------------------------------------------------------------------------------------------------- using System.Collections.Generic; using UnityEngine; namespace UltimateXR.Haptics.Helpers { public partial class UxrHapticOnImpact { #region Private Types & Data /// /// Keeps track of runtime information of all s that can generate hit events by a /// component. /// private class HitPointInfo { #region Public Types & Data /// /// Gets the component whose position will be checked for contacts. /// public Transform HitPoint { get; } /// /// Gets the different velocity samples that are used to average the velocity of the last frames. /// public List VelocitySamples { get; } = new List(VelocityAverageSamples); /// /// Gets or sets the last frame position. /// public Vector3 LastPos { get; set; } /// /// Gets or sets the current velocity. /// public Vector3 Velocity { get; set; } #endregion #region Constructors & Finalizer /// /// Constructor. /// /// Transform of the hit point public HitPointInfo(Transform hitPoint) { HitPoint = hitPoint; for (int i = 0; i < VelocityAverageSamples; ++i) { VelocitySamples.Add(Vector3.zero); } } #endregion } #endregion } }