using Unity.XR.CoreUtils; namespace UnityEngine.XR.Interaction.Toolkit.Locomotion { /// /// Interface for an object that determines the position of the user's body for a given . /// This is used by implementations of to transform the XR Origin using the /// user's body, rather than the tracking origin itself, as the frame of reference. /// public interface IXRBodyPositionEvaluator { /// /// Gets the position of where the user's body is grounded (e.g. their feet), in the local space of the . /// /// The XR Origin whose body position to get. /// Returns the position of where the user's body is grounded, in the local space of the . Vector3 GetBodyGroundLocalPosition(XROrigin xrOrigin); } /// /// Extension methods for . /// public static class XRBodyPositionEvaluatorExtensions { /// /// Gets the world position of where the user's body is grounded (e.g. their feet). /// /// The evaluator that determines the body position. /// The XR Origin whose body position to get. /// Returns the world position of where the user's body is grounded. public static Vector3 GetBodyGroundWorldPosition(this IXRBodyPositionEvaluator evaluator, XROrigin xrOrigin) { return xrOrigin.Origin.transform.TransformPoint(evaluator.GetBodyGroundLocalPosition(xrOrigin)); } } }