view sens and styles

This commit is contained in:
ntr committed 2023-09-03 22:09:13 +10:00
1 parent 6cba0f1295
commit 847b69c401
8 files changed
+97 -28

No files matched your search

+21 -2
View File
@@ -26,6 +26,23 @@ public class ShipControls : MonoBehaviour {
float camYaw;
float clampAngle = 90.0f;
float _invertY = 1.0f;
public bool InvertY {
set {
_invertY = value ? -1.0f : 1.0f;
Debug.Log($"Set invert Y {_invertY}");
}
}
float _viewSens = 1.0f;
public float ViewSens {
get => _viewSens;
set {
_viewSens = value;
Debug.Log($"Set view sensitivity {_viewSens}");
}
}
public PowerUnit powerUnit = new();
public float Speed => rigidBody.velocity.magnitude;
@@ -107,9 +124,11 @@ public class ShipControls : MonoBehaviour {
// delta *= 0.1f; // Account for sensitivity setting on old Mouse X and Y axes.
// def needs to be configurable
Vector2 lookDelta = input.ship.look.ReadValue<Vector2>();
camYaw += lookDelta.x;
camPitch -= lookDelta.y;
camYaw += lookDelta.x * _viewSens;
camPitch -= lookDelta.y * _viewSens * _invertY;
camPitch = Mathf.Clamp(camPitch, -clampAngle, clampAngle);
aim.transform.eulerAngles = new Vector3(camPitch, camYaw, 0.0f);
}