how do i get this code to make it so that it stops moving on mouse position when clicked
public Transform firePoint;
public GameObject player;
public float bulletForce = 20f;
// Update is called once per frame
void Update()
{
if (Input.GetButtonDown("Fire1"))
{
dash1();
}
}
void dash1()
{
Rigidbody2D rb = player.GetComponent();
rb.AddForce(firePoint.up * bulletForce, ForceMode2D.Impulse);
}
}
↧