2D Trajectory Curve,Display trajectory while dragging

Hey there folks,

I hoped someone could help me with my problem. I want to display a trajectory curve using a calculated vector2 value. I’m going to transfer this to mobile input but for now I’m using mouse input. If you click the following script will store the point in space of the player and creates a second transform position while the mouse pointer is down. My goal is to draw a trajectory where the player will land. I’ve already used the search function but i couldn’t find anything that fits. PlayerController script see below:

    public Rigidbody rb;
    public bool point = false;
    public bool pointdown = false;
    public bool pointup = false;
    public float speedset;

    Vector3 pointdownvec;
    Vector3 pointcurrvec;

    void Start ()
    {
        rb = GetComponent<Rigidbody>();
    }
	
    void Update()
    {
     
    }

	
	void FixedUpdate ()
    {
        point = Input.GetButton("Fire1");
        PointerDown();
        pointdown = Input.GetMouseButtonDown(0);
        Drag();
        pointup = Input.GetMouseButtonUp(0);
        PointerUp();
    }

    public void PointerUp ()
    {
        //add.velocity, Pointer ID 0
        if (pointup)
        {
            rb.velocity = Drag() / -speedset;
        }        
    }

    public void PointerDown ()
    {
        //Kurve Laden; Pointer ID 2
        if (point)
        {
            pointdownvec = Input.mousePosition;
        }
    }

    public Vector2 Drag()
    {
        //Kurve
        if (pointdown)
        {
            pointcurrvec = Input.mousePosition;
        }

        Vector2 velovec = pointdownvec - pointcurrvec;
        Debug.Log(velovec);
        return velovec;        
    }

    void OnTriggerEnter(Collider other) //restarting game if fall off
    {
        if (other.CompareTag("Respawn"))
        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    }
}

Try Unity’s wiki page on Trajectory Simulation, or this YouTube tutorial.

Try this tutorial on 2d trajectory helped me alot! 1