Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Changing speed between ControlPoints
#6
Here is an example:

Code:
        public void OnCPReached(CurvySplineMoveEventArgs e)
        {
            if (e.Spline.GetControlPointIndex(e.ControlPoint) == 2)
                e.Sender.Speed = 10;

        }

Add this method to a script (whatever it is), and then select an instance of that script as the object for your On Control Point Reached event, then select the method above.

You can see an example of usage of that event in TrainCarManager.cs, used in the scene 12 to handle the train junction.

If this explanation is not enough, please read this part of Unity's manual: https://docs.unity3d.com/Manual/UnityEvents.html
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply


Messages In This Thread
Changing speed between ControlPoints - by funkd - 07-22-2020, 01:13 PM
RE: Changing speed between ControlPoints - by _Aka_ - 10-02-2020, 12:36 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Smile Constant speed along a spline? tfishell 1 653 11-13-2025, 11:32 AM
Last Post: _Aka_
  Controler Speed from metadata Bryan Thatcher 4 2,673 06-25-2024, 11:18 AM
Last Post: _Aka_
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 2,635 03-18-2024, 07:55 PM
Last Post: _Aka_
  Changing Lanes Antonio 1 1,367 09-17-2023, 08:23 PM
Last Post: _Aka_

Forum Jump: