public static Vector3 GetUpVector(ref Vector3 wsForward, AxisIndex forwardAxis) { Vector3 result = Vector3.zero; if (wsForward != Vector3.zero) { switch (forwardAxis) { case AxisIndex.Y: result.x = 0f - wsForward.y; result.y = wsForward.x; result.z = 0f; break; case AxisIndex.Z: result = Camera.main.transform.up; break; default: Log.LogError(typeof(LocomotionUtils), "GetUpVector() doesn't currently implement AxisIndex.X."); break; } } return(result); }
public float GetAxis(AxisIndex type) { if (!m_axis.ContainsKey(type.ToString())) { Debug.LogError(string.Format("No Axis {0} found!", type)); return(0); } return(m_axis[type.ToString()]); }
public static void StickInputToWorldSpaceTransform(Vector2 stickInput, out Vector3 wsForward, out Vector3 wsUp, AxisIndex forwardAxis) { wsForward = Vector3.zero; wsUp = Vector3.zero; if (stickInput != Vector2.zero) { Transform transform = Camera.main.transform; switch (forwardAxis) { case AxisIndex.Y: wsForward = stickInput.y * transform.up + stickInput.x * transform.right; wsForward.z = 0f; wsForward.Normalize(); wsUp.x = 0f - wsForward.y; wsUp.y = wsForward.x; wsUp.z = 0f; break; case AxisIndex.Z: { Vector3 normalized = Vector3.Scale(transform.forward, new Vector3(1f, 0f, 1f)).normalized; wsForward = stickInput.y * normalized + stickInput.x * transform.right; wsForward.y = 0f; wsForward.Normalize(); wsUp = Vector3.up; break; } } } }
public static Vector3 StickInputToWorldSpaceTransform(Vector2 stickInput, AxisIndex forwardAxis) { StickInputToWorldSpaceTransform(stickInput, out var wsForward, out var _, forwardAxis); return(wsForward); }
public string GetStringKey(InputSystemOption iso, AxisIndex key) { return(GetStringKey(iso, key.ToString())); }