In the Unity manual it lists a method for getting the direction between two points
// Gets a vector that points from the player's position to the target's.
var heading = target.position - player.position;
var distance = heading.magnitude;
var direction = heading / distance; // This is now the normalized direction.
// calculate slant angle
Vector3 originVector = new Vector3 (x1,y1,z);
Vector3 outerVector = new Vector3 (x2,y2,z);
Vector3 heading = originVector - outerVector;
float distance = heading.magnitude;
The problem I’m having is since magnitude is a float value and everything else is a Vector3 the types are not compatible. The example keeps the types generic but that doesn’t seem right as they are specifically talking about making calculations with Vectors.
So my question is how to I get this to work in C# as intended in the linked manual page. Am I just supposed to cast?