Skip to content

Commit

Permalink
fix negative distance to origin in orbit cemra control
Browse files Browse the repository at this point in the history
  • Loading branch information
nlsdvl committed Nov 21, 2024
1 parent 1c3db2c commit 6fdb11b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Assets/Scripts/Runtime/CameraController/OrbitControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

using UnityEngine;
using UnityEngine.InputSystem;
using System;

public class OrbitControl : MonoBehaviour
{
Expand Down Expand Up @@ -82,10 +83,10 @@ private void Update()
float currentTouchDistance = Vector2.Distance(tZero.position, tOne.position);
float deltaDistance = oldTouchDistance - currentTouchDistance;
currentDistance -= deltaDistance * Time.deltaTime;
currentDistance = Math.Max(0, currentDistance);
} else {
float moveInput = moveAction.ReadValue<Vector2>().y;
currentDistance -= moveInput * Time.deltaTime;

}
}

Expand Down

0 comments on commit 6fdb11b

Please sign in to comment.