Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GetNearestPointTf
#1
Hi there. I have a problem with GetNearestPointTf. The point is that i have object with 2 child, between them i create a spline (lets name it A). After that, i need to check every spline crossing my A spline. I found the method GetNearestPointTf, but i cant find what i need. In addition, i can say that i have many of those objects. Can u please give me some hint, or maybe say what im doing wrong.
Code:
GameObject spline = new GameObject("CurveLine", typeof(CurvySpline), typeof(LineRenderer), typeof(CurvyLineRenderer));
                spline.GetComponent<>(CurvySpline).Add(firstObject.transform.position, secondObject.transform.position);
                float step = 2f;
                Vector3 position = firstObject.transform.position;
                while (position.z < secondObject.transform.position)
                {
                    Vector3 inversePositionOnSpline = spline.transform.InverseTransformPoint(position);
                    float nearestTf = spline.GetComponent<CurvySpline>().GetNearestPointTF(inversePositionOnSpline);
                   
                    Vector3 positionForSphere = spline.transform.TransformPoint(spline.GetComponent<CurvySpline>().Interpolate(nearestTf));
                    GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
                    sphere.transform.position = positionForSphere;
                    position.z += step;
                }
Reply


Messages In This Thread
GetNearestPointTf - by DunchaLin3 - 09-27-2020, 03:28 PM
RE: GetNearestPointTf - by _Aka_ - 09-27-2020, 05:21 PM
RE: GetNearestPointTf - by _Aka_ - 09-27-2020, 05:31 PM
RE: GetNearestPointTf - by _Aka_ - 09-27-2020, 05:32 PM
RE: GetNearestPointTf - by DunchaLin3 - 09-27-2020, 06:03 PM
RE: GetNearestPointTf - by _Aka_ - 09-27-2020, 11:11 PM
RE: GetNearestPointTf - by DunchaLin3 - 09-28-2020, 06:14 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Looping splines and GetNearestPointTF Sacryn 1 209 10-13-2021, 02:07 PM
Last Post: _Aka_

Forum Jump: