How to instantiate object directly backwards from another

In a 2D topdown game, I’d like to instantiate a prefab positioned directly behind another. Much like a ship laying mines; they should appear in the opposite direction from the way the ship is facing.

How do I get the vector that describes the direction the ship is facing and how can i translate backward along that vector to find where the position the mine should be?

My ship moves between waypoint vectors using the following script:

float step = speed * Time.deltaTime;
transform.position = Vector3.MoveTowards(transform.localPosition, waypoint, step);
Quaternion qTo = Quaternion.LookRotation(transform.position - waypoint, Vector3.forward);
qTo.x = 0;
qTo.y = 0;
transform.rotation = Quaternion.Slerp(transform.rotation, qTo, rotSpeed * Time.deltaTime);

Any help would be great.

What you want to do is transform a position from the ship’s transform’s local space into world space and then Instantiate at that point. Assuming your ship’s forward facing is standard, do:

float distanceFromShip = 0.1f;
Vector3 positionBehind = shipTransform.TransformPoint(new Vector3(0f, 0f, -distanceFromShip));
Instantiate(minePrefab, positionBehind, Quaternion.identity);

TransformPoint takes a position in local space and converts it to world space while taking into account scale.