3D camera for 2D game projectile not shoot to crosshair?

Subtract the projectile’s origin (or player’s origin) from the projected mouse position.

This gives you the “to” vector.

Then use that as follows:

You may be able to simply drive transform.forward (or transform.up or transform.right when in 2D) equal to your movement vector.

Otherwise, use Mathf.Atan2() to derive heading from cartesian coordinates:

Sine/Cosine/Atan2 (sin/cos/atan2) and rotational familiarity and conventions