Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] API Move() and Events example
I want to use the API command Move() and get a callback through the Event-System.
This is useful to get a function call in side the current script while Move() reaches a ControlPoint.

If any SplineController runs over the Spline.ControllPoint then nControlPointReachedEvent() is triggered well.
You can determine the SC in e.Sender for sure (see Default Curvy Events Handler.cs)

But unfortunately I get no fire while Move() runs over a CP.
Perhaps I use Move(tf, dir, fdist, clamp) in a wrong way?

public class PassiveFollower : MonoBehaviour {
   public CurvySpline Spline;
   public float aDist;
   public float tf = 0;
   public int dir = 1;
   public Vector3 posfollow;

   IEnumerator Start() {
       // Wait until the spline is initialized
       if (Spline) {
           while (!Spline.IsInitialized)
               yield return null;
       // Add EventTrigger to the current Spline
   void Update() {
       aDist += 0.01f;
       tf = Spline.DistanceToTF(aDist);
       posfollow = Spline.Move(ref tf, ref dir, 0.01, CurvyClamping.Clamp) + Spline.transform.position;
       transform.position = posfollow;
   void onControlPointReachedEvent(CurvySplineMoveEventArgs e) {
       //Gets triggered by a SplineCOntroller but not by Move();
(Henry Ford) Each hour more of searching is each hour less of your live time.

Tried your script and it's working. So it must be a matter of versions. I tried it with 2.0.4 and the latest dev repo. So you're perhaps using an older, intermediate dev version, I remember that I fixed the GC alloc issue one day and another related issue two days later. The latter problem was that runtime event binding wasn't recognized - this would explain your problem exactly.

Possibly Related Threads…
Thread Author Replies Views Last Post
  GameObjects that move along the path of Curvy Splines will protrude. yanke 3 59 10-22-2021, 11:58 AM
Last Post: _Aka_
  Playmaker events Lupp_ 10 2,418 01-15-2021, 05:11 PM
Last Post: _Aka_
  Move with constant velocity in Relative mode athos_k 3 1,735 07-21-2020, 11:39 AM
Last Post: _Aka_
  Move CP00X position in hierarchy UsernameHed 1 1,758 11-12-2019, 02:01 PM
Last Post: _Aka_

Forum Jump: