namespace VRTK.Prefabs.Interactions.Controllables
{
using UnityEngine;
///
/// Denotes a world axis for the drive to operate on.
///
public static class DriveAxis
{
///
/// The axis to operate the drive on.
///
public enum Axis
{
///
/// The world space X Axis.
///
XAxis,
///
/// The world space Y Axis.
///
YAxis,
///
/// The world space Z Axis.
///
ZAxis
}
///
/// Gets the axis direction for the given .
///
/// The desired world axis.
/// Whether to get the negative axis direction.
/// The direction of the drive axis.
public static Vector3 GetAxisDirection(this Axis axis, bool negativeDirection = false)
{
Vector3 axisDirection = Vector3.zero;
switch (axis)
{
case Axis.XAxis:
axisDirection = negativeDirection ? Vector3.left : Vector3.right;
break;
case Axis.YAxis:
axisDirection = negativeDirection ? Vector3.down : Vector3.up;
break;
case Axis.ZAxis:
axisDirection = negativeDirection ? Vector3.back : Vector3.forward;
break;
}
return axisDirection;
}
}
}