From a9097ee7747786f81fea5b5cc8c1d3c2dff6b2a7 Mon Sep 17 00:00:00 2001
From: AdamElf <55642322+AdamElf@users.noreply.github.com>
Date: Wed, 20 Mar 2024 17:20:50 -0400
Subject: [PATCH] made velocity tracking better

---
 Assets/Scripts/Objects/ObjectHealth.cs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Assets/Scripts/Objects/ObjectHealth.cs b/Assets/Scripts/Objects/ObjectHealth.cs
index a20df3a..c31e49b 100644
--- a/Assets/Scripts/Objects/ObjectHealth.cs
+++ b/Assets/Scripts/Objects/ObjectHealth.cs
@@ -48,7 +48,8 @@ public void Damage(float damage)
     /// </summary>
     private void Shatter()
     {
-
+        float multMin= 0.5f;
+        float multMax= 1.5f;
         //Make Object shatter here
         //get the two children of the object that is breaking
         broken1 = this.transform.GetChild(0).gameObject;//unbroken object
@@ -63,7 +64,7 @@ private void Shatter()
         Debug.Log(velocity);
         foreach (Rigidbody rb in broken2.GetComponentsInChildren<Rigidbody>())
         {
-            rb.velocity = new Vector3(velocity.x * Random.Range(0.75f,1.25f), velocity.y * Random.Range(0.75f, 1.25f), velocity.z * Random.Range(0.75f, 1.25f));
+            rb.velocity = new Vector3(velocity.x * Random.Range(multMin,multMax), velocity.y * Random.Range(multMin, multMax), velocity.z * Random.Range(multMin, multMax));
             Debug.Log(rb.velocity);
         }
         //Debug.Log("Shatter()");
-- 
GitLab