Controller Events

For now, Controller Events are limited to Spline Controllers

You can react to certain movement related events by adding a handler to the following UnityEvents:



Called when moving over a Control Point



Called when the end (or start) of the source spline is reached



Called during a spline switch

When you add an event handler by code, be sure to call BindEvents() afterwards! Please support our request to being able to check for event handlers without feeding the GC!
Events using this EventArgs are called during a movement. This class offers several methods to influence the further movement (e.g. use a connection)


Name Description
Direction current movement direction (1 or -1)
Delta TF or world units distance left
TF current TF
WorldUnits whether Delta is TF or World Units
Control Point Current Control Point (from CurvyControlPointEventArgs)
Spline Current Spline (from CurvySplineEventArgs)


Name Description
SetPosition() Continue movement at another position (may be on another spline as well)
Follow() Continue movement at another spline (sets direction and delta to fit)
AngleTo() Gets the angle to another Control Point


The following callback method (being part of the CurvyDefaultEventHandler component) can be bound to the OnEndCPReached (or OnCPReached) event of the SplineController and it's called each time the controller reaches the first or last Control Point of it's spline. If the event's Control Point has a FollowUp defined in a connection, it's used to continue movement on:

public void UseFollow (CurvySplineMoveEventArgs e)
            // we need a SplineController as well as a following spline to work with
            if (e.Sender is SplineController && e.ControlPoint.FollowUp)
                // Follow the connected spline
                e.Follow(e.ControlPoint.FollowUp, e.ControlPoint.FollowUpHeading);
                // Set the controller to use the new spline
                SplineController controller = (SplineController)e.Sender;
                controller.Spline = e.Spline;
                controller.RelativePosition = e.TF;
                // Handle controller events for the new passed ControlPoint