okay, I found the function to generate curve at runtime..
here is the shadow code that I think will work
so... is that all I need ?
Question about "curveA.GetApproximation()" I expect will get the closest point instead of array of Vector3, am I doing it wrong ?
since I got startFT from "GetNearestPointTF"
... continue testing.
here is the shadow code that I think will work
Code:
Transform m_Ship = null; // assume we got this
CurvySpline curveA = null; // assume we got this
CurvySpline curveB = null; // assume we got this
float startTF = curveA.GetNearestPointTF(m_Ship.position, Space.World);
Vector3 startPoint = curveA.GetApproximation(startTF, startTF, true, Space.World)[0]; // Huh ? how to get the closer sample point ?
Vector3 startTangent = m_Ship.forward * 2f; // bias
float endTF = curveB.GetNearestPointTF(startTangent, Space.World);
Vector3 endPoint = curveA.GetApproximation(endTF, endTF, true, Space.World)[0];
Vector3 endTangent = curveA.GetOrientationFast(endTF, false, Space.World) * Vector3.forward;
var curve = CurvySpline.Create();
var start = curve.Add(startPoint, Space.World);
start.HandleOut = start.transform.InverseTransformPoint(startTangent); // is that the right way to convert local space ?
var end = curve.Add(endPoint, Space.World);
end.HandleIn = endTangent;
so... is that all I need ?
Question about "curveA.GetApproximation()" I expect will get the closest point instead of array of Vector3, am I doing it wrong ?
since I got startFT from "GetNearestPointTF"
... continue testing.