Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reversing over Connection CP from Junction
#5
Hi,
After looking at your project, here is the solution:
Replace the code assigning the value of ConnectionBehavior with this:
Code:
           if(splineController.MovementDirection == MovementDirection.Forward)
           {
               if (jc && jc.UseJunction == false)
                   splineController.ConnectionBehavior = SplineControllerConnectionBehavior.CurrentSpline;
               else
                   splineController.ConnectionBehavior = SplineControllerConnectionBehavior.RandomSpline;
           }
           else
               splineController.ConnectionBehavior = SplineControllerConnectionBehavior.FollowUpSpline;
Here is the exaplanation of what was wrong in your code:
You were telling the train to, when on the side spline and reversing on a connection with UseJunction set to false, to continue on the current spline. That current spline was stopping at the connection, so it is normal that the train remains stuck there. You had to tell it instead to get back to the main spline.
The documentation of SplineControllerConnectionBehavior.FollowUpSpline reads as follow:
"Move to the spline containing the Follow-Up if any. If none, continue moving on the current spline, ignoring the connection."
Which is perfect for your use case: when on the side spline the follow up is the main spline, and when on the main spline there is no follow up.

Is it clear?
Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Messages In This Thread
RE: Reversing over Connection CP from Junction - by _Aka_ - 01-12-2020, 12:32 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_
Thumbs Up Can't delete connection lacota 3 6 03-16-2024, 11:34 AM
Last Post: _Aka_
Lightbulb Junction & Connection Navigation System Design SAMYTHEBIGJUICY 4 13 11-27-2023, 01:04 PM
Last Post: _Aka_
  Connection "next' control point jh092 3 15 11-22-2023, 11:47 AM
Last Post: _Aka_

Forum Jump: