Skip to content

Commit

Permalink
Fixed issues with mouse movement being too fast on desktop plattforms
Browse files Browse the repository at this point in the history
  • Loading branch information
David Liebemann committed Aug 2, 2022
1 parent 9459e0b commit ede5f43
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1497,6 +1497,7 @@ MonoBehaviour:
mouseDelta: {fileID: 8009718129426777221, guid: 569da38d22d72724586e88d08c36b7a6, type: 3}
rotationSpeed: 0.6
mobileRotationSpeedMultiplier: 0.75
mouseRotationSpeedMultiplier: 0.25
clampPitch: 80
yawTarget: {fileID: 2753487309498945351}
pitchTarget: {fileID: 2488659525853046605}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class FirstPersonRotation : MonoBehaviour
/// On mobile, a slower rotation speed is preferable.
/// </summary>
[SerializeField] private float mobileRotationSpeedMultiplier = 0.5f;
[SerializeField] private float mouseRotationSpeedMultiplier = 0.25f;


/// <summary>
Expand Down Expand Up @@ -61,9 +62,10 @@ private void Update()
float yaw = gamepadInput.x * Time.deltaTime;
float pitch = gamepadInput.y * Time.deltaTime;

// mouse delta is already multiplied by Time.deltaTime.
Vector2 mouseInput = mouseDelta.action.ReadValue<Vector2>();
yaw += mouseInput.x;
pitch += mouseInput.y;
yaw += mouseInput.x * mouseRotationSpeedMultiplier;
pitch += mouseInput.y * mouseRotationSpeedMultiplier;

float rotationSpeedMultiplier = rotationSpeed;

Expand Down
2 changes: 1 addition & 1 deletion ODIN-SampleProject/ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ PlayerSettings:
16:10: 1
16:9: 1
Others: 1
bundleVersion: 0.16.2
bundleVersion: 0.16.3
preloadedAssets:
- {fileID: 0}
- {fileID: 0}
Expand Down

0 comments on commit ede5f43

Please sign in to comment.