You may be able to simply drive transform.forward
(or transform.up
when in 2D) equal to your movement vector, such as.
slashInstance.transform.up = vectorToPlayer;
NOTE: you must get slashInstance
back from the Instantiate()
call.
Otherwise, use Mathf.Atan2()
to derive heading from cartesian coordinates:
Sine/Cosine/Atan2 (sin/cos/atan2) and rotational familiarity and conventions