launching an object toward another object,Lunch object towards a specific object?

hi im new to unity and im trying to creat a 2d platformer
im struggling with throwing the player character in an object direction
i have a 2d player with a basic movment script and i want him to be thrown toward a object
every time the left mouse button is clicked


public class throwPlayer : MonoBehaviour
Rigidbody2D rb;

 public Transform fireTowerds;

 public float force;

void Start()

//called from another script when left mouse button is clicked

public void throw()

You just need to get the direction by subtracting transform position of the player from the object. This will give you the magnitude and direction of force. Apply it by using rb.AddForce

Try rb.AddForce(object.transform.position - transform.position)
If this works, please “Accept Answer”