Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to stop spline refreshing when a control point is deleted or removed?
#1
Hi, I using Curvy to make roads in my game.

Player can delete and move control points, but when this done the rest of the spline changes shape, so the spline does not match the road mesh.

I would like the spline not to change shape when control points are deleted or moved. How can I do this? I cannot find a way in the api to do this.

Thank you.
Reply
#2
Hi
Do you want the spline to not change at all, or do you want the change to be more localised? If it is the latter, try set the interpolation type of your spline to Bezier. Bezier, compared to Catmull-Rom or BSplines, have its Control Points modify a smaller part of the spline around it.
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
Thank you for message.

I want the spline to not change at all. 

(And I am using Bezier).
Reply
#4
I think I found how to do it, so I will write it here to help anybody else that needs it.

This is when using Bezier splines:

To stop neighboring spline segments from changing shape when you delete a segment, all you need to do is set AutoHandles = false for the control points next to the ones you remove. This keeps the original angle of the spline that comes from them.


Code:
cpBeforeSplit.AutoHandles = false;

cpAfterSplit.AutoHandles = false;

theSpline.Split(cpAfterSplit);
Reply
#5
Hi
Thanks for sharing the solution.
What you described is what I meant with "the change to be more localised". Now I understand exactly what you meant.
Sorry for not having answered a useful answer.
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


Possibly Related Threads…
Thread Author Replies Views Last Post
  Curvy Line Renderer for UI Spline? gekido 1 1 Yesterday, 10:12 PM
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 2 Yesterday, 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_
  GO can't fit end of the spline GameDeveloperek4123 3 13 03-04-2024, 11:06 AM
Last Post: _Aka_

Forum Jump: