// --------------------------------------------------------------------------------------------------------------------
//
// Copyright (c) VRMADA, All rights reserved.
//
// --------------------------------------------------------------------------------------------------------------------
using UltimateXR.Core.Components;
using UnityEngine;
namespace UltimateXR.Manipulation
{
///
/// Base class to create more advanced grips (cylindrical, box...).
/// An enables grabbing an object. A grabPoint inside the
/// defines where and how the object will snap to the hand. Additionally, if there is
/// an based component on the same object, it will "expand" the snapping from a
/// single point to a more complex shape like a an axis, a cylinder, a box... This way an object can be picked up from
/// many different places just by specifying a snap point and some additional properties.
///
[RequireComponent(typeof(UxrGrabbableObject))]
public abstract class UxrGrabPointShape : UxrComponent
{
#region Inspector Properties/Serialized Fields
[SerializeField] protected UxrGrabPointIndex _grabPointIndex = new UxrGrabPointIndex(0);
#endregion
#region Public Types & Data
///
/// Gets the grab point from the this object extends.
///
public UxrGrabPointIndex GrabPoint => _grabPointIndex;
#endregion
#region Public Methods
///
/// Gets the distance from a to a grab point, defined by transform used for snapping and the
/// transform used to compute proximity.
///
/// Grabber to compute the distance from
/// The on the grabbable object that is used to align to the grabber
///
/// The on the grabbable object that is used to compute the
/// distance to the
///
///
/// The on the grabber that is used to compute the distance
/// to the
///
/// Distance value
public abstract float GetDistanceFromGrabber(UxrGrabber grabber, Transform snapTransform, Transform objectDistanceTransform, Transform grabberDistanceTransform);
///
/// Gets the closest snap position and rotation that should be used when a tries to a grab
/// point, defined by transform used for snapping and the transform used to compute proximity.
///
/// Grabber to compute the snapping for
/// The on the grabbable object that is used to align to the grabber
///
/// The on the grabbable object that is used to compute the
/// distance to the grabber
///
///
/// The on the grabber that is used to compute the distance
/// to the
///
/// Snap position
/// Snap rotation
/// Distance value
public abstract void GetClosestSnap(UxrGrabber grabber, Transform snapTransform, Transform distanceTransform, Transform grabberDistanceTransform, out Vector3 position, out Quaternion rotation);
#endregion
}
}