aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Assets/Scripts/Controllers/Ball.cs
diff options
context:
space:
mode:
authorCarson Katri <carson.katri@gmail.com>2021-06-12 23:01:15 -0400
committerCarson Katri <carson.katri@gmail.com>2021-06-12 23:01:15 -0400
commit21b894f8c6fabee844e9d4f970e422454658cc40 (patch)
tree29e47ead47b69982a9a96bfbc275315ddfa5a13f /Assets/Scripts/Controllers/Ball.cs
parentf913672cb017632ef115d2fb7a0c4d531650faf0 (diff)
downloadgmtk-gamejam-21b894f8c6fabee844e9d4f970e422454658cc40.tar.gz
gmtk-gamejam-21b894f8c6fabee844e9d4f970e422454658cc40.tar.zst
gmtk-gamejam-21b894f8c6fabee844e9d4f970e422454658cc40.zip
Finally fix shooting
Diffstat (limited to 'Assets/Scripts/Controllers/Ball.cs')
-rw-r--r--Assets/Scripts/Controllers/Ball.cs9
1 files changed, 3 insertions, 6 deletions
diff --git a/Assets/Scripts/Controllers/Ball.cs b/Assets/Scripts/Controllers/Ball.cs
index 936b857..ae0656f 100644
--- a/Assets/Scripts/Controllers/Ball.cs
+++ b/Assets/Scripts/Controllers/Ball.cs
@@ -1,5 +1,3 @@
-using System;
-using System.Net.Mime;
using UnityEngine;
namespace Controllers
@@ -20,11 +18,10 @@ namespace Controllers
controller.BallDropped();
}
- public void Shoot(Vector3 target, float time)
+ public void Shoot(Hoop target, float time)
{
- transform.right = target - transform.position;
- Rigidbody.velocity = Vector2.zero;
- Rigidbody.AddForce((transform.right + (transform.up * 0.5f)) * (shotForce * ((Mathf.Clamp(time, 0f, 1f) + 1))));
+ transform.localRotation = Quaternion.identity;
+ Rigidbody.velocity = (Vector2)((target.transform.position - transform.position).normalized + transform.up * Mathf.Clamp(time, 0f, 1f)) * shotForce;
}
}
}