aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Assets/Scripts/Controllers/Ball.cs
diff options
context:
space:
mode:
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;
}
}
}