Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Switch Spline Problem
#1
If it has reached the end of the spline, I want it to move to the next spline. I want to do this through code. It switches from spline 1 to spline 2 but does not complete spline 2. and it doesn't switch to the 3rd spline. How can I do it?


My SplineController Code:

public void GoNextSpline()
        {
            SwitchTo(splineTest, 1, 1); 
            IsAtEnd = false;
        }


public void OnEndReachedMethod()
        {
            IsAtEnd = true;
        }



My Other Code:

public CurvySpline myPreviousSpline;
    public CurvySpline myEnterSpline;
    public CurvySpline myExitSpline;
public SplineController splineController;

void Update()
    {
if (splineController.Spline == previousSpline && splineController.IsAtEnd)
                splineController.GoNextSpline();

        if (splineController.Spline == enterSpline && splineController.IsAtEnd)
            splineController.GoNextSpline();

        if (splineController.Spline == exitSpline && splineController.IsAtEnd)
            splineController.GoNextSpline();
}
Reply
#2
Hi
The second parameter of SwitchTo is the destination TF. By setting it to 1, the switch will put you at the end of the spline. Try setting it to 1.
Did this help?
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
(05-29-2023, 07:26 PM)_Aka_ Wrote: Hi
The second parameter of SwitchTo is the destination TF. By setting it to 1, the switch will put you at the end of the spline. Try setting it to 1.
Did this help?

already 1
Reply
#4
I solved the problem by typing " m_Position = 0;" inside the gonextspline method. but now I have a new problem and unfortunately it is inexplicably complex. Sad
Reply
#5
Hi
Can you tell me what you are trying to do exactly? Maybe using SwitchTo is not what you need. Do you just need to make your controller follow another spline once it reaches the end of a first one? If so, have you thought about using connections? You can see it used in example scene 03_Connections.

The SwitchTo applies a transition that is not instant. More about that method here:
https://api.curvyeditor.com/FluffyUnderw...em_Single_

By setting position to 0, you will not stop the position to be set to 1 at the end of the transition, that you set to take 1 second.

If you give me more information about your end goal, I will probably be able to help you more.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Curvy Line Renderer for UI Spline? gekido 5 12 10-29-2024, 10:19 AM
Last Post: _Aka_
  Nested Spline Volume Spot Instantiation merobbins5 3 7 07-26-2024, 09:58 AM
Last Post: _Aka_
  Left-right movement, and spline follow shihaya 3 10 07-12-2024, 12:50 PM
Last Post: _Aka_
  How to start volume spots at the end of spline instead of front j95677 1 5 07-07-2024, 04:58 AM
Last Post: _Aka_

Forum Jump: