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
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_
  Connections Problem Juton 3 14 03-06-2024, 10:41 AM
Last Post: _Aka_
  GO can't fit end of the spline GameDeveloperek4123 3 13 03-04-2024, 11:06 AM
Last Post: _Aka_
  Keeping a fixed spline length jh092 3 16 02-21-2024, 06:25 AM
Last Post: Primrose44

Forum Jump: