I have been looking for this for over a day and I can’t find it.
I am trying to create an arrow thats instantiated from its tower and starts with a target (an enemy). The enemy is sometimes moving so it needs to hit it every time. I need the arrow to arch over before hitting the enemy.
This is what I have and it moves in a straight line, (and back after but that doesn’t matter as it will destroy on impact) without any physics. It gets ward if I add any gravity.
ovrDistanceToTarget = startPos.x - target.transform.position.x;
currentDistanceToTarget = transform.position.x - target.transform.position.x;
Vector2 v = new Vector2 (target.transform.position.x - transform.position.x, target.transform.position.y - transform.position.y);
print (GetComponent<Rigidbody2D>().velocity);
float angle = Mathf.Atan2(v.y, v.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
GetComponent<Rigidbody2D>().AddForce(transform.right * 15 * Time.deltaTime, ForceMode2D.Impulse);
Is there a better way to do this? Preferably without much physics.