Browse Source

auto populate spline points

master
Sagittaeri 7 years ago
parent
commit
771babe235
2 changed files with 13 additions and 0 deletions
  1. +13
    -0
      IronToad_UnityProject/Assets/Lighthouse.cs
  2. BIN
      IronToad_UnityProject/Assets/_Scenes/LighthouseTestScene.unity

+ 13
- 0
IronToad_UnityProject/Assets/Lighthouse.cs View File

@ -21,6 +21,19 @@ public class Lighthouse : MonoBehaviour
{ {
splineCursor = splineCurve.GetComponent<BGCcCursor>(); splineCursor = splineCurve.GetComponent<BGCcCursor>();
if (splineDistantPoints == null || splineDistantPoints.Count == 0)
{
splineDistantPoints.Add(0f);
for (int i=1; i<splineCurve.PointsCount; i++)
{
BGCurvePointI point = splineCurve.Points[i];
float distance = 0f;
splineCursor.Math.CalcPositionByClosestPoint(point.PositionLocal, out distance);
splineDistantPoints.Add(distance);
}
splineDistantPoints.Add(splineCursor.Math.GetDistance());
}
splineCursor.Distance = 0f;
moveToNextPoint(); moveToNextPoint();
} }

BIN
IronToad_UnityProject/Assets/_Scenes/LighthouseTestScene.unity View File


Loading…
Cancel
Save