Spline
Introduction
Creating a Spline in code
using FlatRedBall.Math.Splines; // Create a new spline
Spline spline = new Spline();
// Let's add 4 points.
SplinePoint point = new SplinePoint();
point.Position = new Vector3(0, 0, 0);
spline.Add(point);
// The first point's Time defaults to zero. Set non-zero
// times for all additional SplinesPoints.
point = new SplinePoint();
point.Position = new Vector3(30, 30, 0);
point.Time = 2;
spline.Add(point);
point = new SplinePoint();
point.Position = new Vector3(-40, 60, 0);
point.Time = 4;
spline.Add(point);
point = new SplinePoint();
point.Position = new Vector3(-80, -110, 0);
point.Time = 6;
spline.Add(point);
// CalculateVelocities must be called before
// CalculateAccelerations is called.
spline.CalculateVelocities();
spline.CalculateAccelerations();
// Let's make it visible so we can see our creation.
spline.Visible = true;
Positioning objects using a Spline
Splines are ILists
Last updated
Was this helpful?