done what you suggested as I realised how easy it would be to modify the square root to have the full 2d distance calculation, this should help anyone who is looking to do any 2D distance mapping souch as click location or touch location (plus many more uses) I currently left it in the math section however here is the code.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Math)]
[Tooltip("gives the distance between two points (2d location, e.g. screen)")]
public class 2DDistance : FsmStateAction
{
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmFloat floatVariableLocation1X;
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmFloat floatVariableLocation1Y;
[UIHint(UIHint.Variable)]
public FsmFloat floatVariableLocation2X;
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmFloat floatVariableLocation2Y;
public FsmFloat floatVariableDistance;
public bool everyFrame;
public override void Reset()
{
floatVariableLocation1X = null;
floatVariableLocation2X = null;
floatVariableLocation1Y = null;
floatVariableLocation2Y = null;
everyFrame = false;
}
public override void OnEnter()
{
DoFloatSqrt();
if (!everyFrame)
Finish();
}
public override void OnUpdate()
{
DoFloatSqrt();
}
void DoFloatSqrt()
{
floatVariableDistance.Value = Mathf.Sqrt(Mathf.Pow(floatVariableLocation2X.Value - floatVariableLocation1X.Value, 2) + Mathf.Pow(floatVariableLocation2Y.Value - floatVariableLocation1Y.Value, 2));
}
}
}
it uses a float for each X and Y for each location
Edit*
reason I never looked into 2 vectors is because screen location either works by X&Y seperatly or 3vector from what I understand