Elegantly flattening a relative vector

Vector3 zed = other.transform.InverseTransformVector (transform.position - other.transform.position);
zed .x = 0f;
zed .y = 0f;
zed = other.transform.position + other.transform.TransformVector (zed);

I’m using this for grind physics. This takes my player’s position relative to a waypoint, converts it to the waypoint’s local space, removes X and Y then converts it back to world space to get the player’s position between waypoints

I’d like to know if there’s a way to do that that’s not quite so hilariously messy and expensive.

Well all you need is Vector3.Project:

Vector3 zed = transform.position - other.transform.position;
zed = Vector3.Project(zed, other.transform.forward);