public float GetAxis(CommonAxis axis) { if (device.TryGetFeatureValue(GetCommonAxis(axis), out float axisValue)) { return(axisValue); } return(0); }
float CalculateOffset(CommonAxis axis, float localPosition, float speed, float range) { float axisThrow = CrossPlatformInputManager.GetAxis(axis.ToString()); float offset = axisThrow * Time.deltaTime * speed; float raw = Mathf.Clamp(localPosition + offset, -range, range); return(raw); }
public static InputFeatureUsage <float> GetCommonAxis(CommonAxis axis) { if (axis == CommonAxis.grip) { return(CommonUsages.grip); } else { return(CommonUsages.trigger); } }