Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
To dynamic generate the connection between paths
#2
okay, I found the function to generate curve at runtime..
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.
Reply


Messages In This Thread
RE: To dynamic generate the connection between paths - by Canis - 08-07-2020, 08:43 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Lightbulb Junction & Connection Navigation System Design SAMYTHEBIGJUICY 6 4,065 03-25-2026, 10:10 PM
Last Post: _Aka_
  Is there a way to generate UVs along deformed and copied mesh? kubak 1 552 03-18-2026, 08:34 PM
Last Post: _Aka_
  How to generate gameobject on the control point Yang Yi 1 1,779 12-10-2024, 10:14 PM
Last Post: _Aka_
  Anomalous connection handling SAMYTHEBIGJUICY 1 1,517 12-04-2024, 05:08 PM
Last Post: _Aka_

Forum Jump: