From 6205c630242900e6ab9f0b4bc4da3cc3cf3f33a5 Mon Sep 17 00:00:00 2001 From: GAmuzak Date: Wed, 4 Dec 2024 20:39:49 -0800 Subject: [PATCH] v2.3.2 Fixed ball stopping criteria more accurate now --- Assets/_Scripts/Golf/GolfBallController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/_Scripts/Golf/GolfBallController.cs b/Assets/_Scripts/Golf/GolfBallController.cs index 3965323..a5c0bac 100644 --- a/Assets/_Scripts/Golf/GolfBallController.cs +++ b/Assets/_Scripts/Golf/GolfBallController.cs @@ -39,7 +39,7 @@ private void FixedUpdate() if (!isMoving) return; Vector3 direction = (targetPosition - transform.position).normalized; float distance = Vector3.Distance(transform.position, targetPosition); - if(distance > 0.01f && (rb.velocity.magnitude > 0.02f || distance > 1f)) + if(distance > 0.01f && (rb.velocity.magnitude > 0.005f || distance > 1f)) { float easingFactor = 1 - Mathf.Exp(-distance * 0.22f); rb.velocity = (direction * (easingFactor * maxSpeed)).XZPlane(-1.2f); //hack to make falling look realistic @@ -85,7 +85,7 @@ private void OnDrawGizmos() { if (!isMoving) return; Gizmos.color = Color.blue; - Gizmos.DrawWireSphere(targetPosition, 0.08f); + Gizmos.DrawWireSphere(targetPosition, 0.03f); } public void ResetBall()