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
  How to get length starting from one spline to connected nth spline Dragon-3623 1 1 05-14-2024, 04:52 PM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 3 6 04-04-2024, 12:56 PM
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 6 03-28-2024, 10:08 PM
Last Post: _Aka_
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_

Forum Jump: