VR4Medical/ICI/Library/PackageCache/com.unity.xr.interaction.toolkit@42ef3600567b/Runtime/Locomotion/UnderCameraBodyPositionEvaluator.cs
2025-07-29 13:45:50 +03:00

25 lines
1002 B
C#

using Unity.XR.CoreUtils;
namespace UnityEngine.XR.Interaction.Toolkit.Locomotion
{
/// <summary>
/// Scriptable object that estimates the user's body position by projecting the position of the camera onto the
/// XZ plane of the <see cref="XROrigin"/>.
/// </summary>
/// <remarks>
/// This is the default <see cref="XRBodyTransformer.bodyPositionEvaluator"/> for an <see cref="XRBodyTransformer"/>.
/// </remarks>
[CreateAssetMenu(fileName = "UnderCameraBodyPositionEvaluator", menuName = "XR/Locomotion/Under Camera Body Position Evaluator")]
[HelpURL(XRHelpURLConstants.k_UnderCameraBodyPositionEvaluator)]
public class UnderCameraBodyPositionEvaluator : ScriptableObject, IXRBodyPositionEvaluator
{
/// <inheritdoc/>
public Vector3 GetBodyGroundLocalPosition(XROrigin xrOrigin)
{
var bodyPosition = xrOrigin.CameraInOriginSpacePos;
bodyPosition.y = 0f;
return bodyPosition;
}
}
}