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 helps immensely. Thank you.
Available for freelance work—feel free to reach out.
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 helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Photo Volume Spots problem with spacing Bond007 1 2 12-05-2024, 11:17 PM
Last Post: _Aka_
  Method of scattering objects along spline joebain 1 3 11-26-2024, 03:20 PM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 5 13 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_

Forum Jump: