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


Possibly Related Threads…
Thread Author Replies Views Last Post
  OnAfterControlPointAdded - Control Point is null jh092 5 313 02-04-2025, 09:31 PM
Last Post: _Aka_
  Disable a spline's gizmo when not selected or disabled. mikechr2000 1 139 02-03-2025, 09:34 AM
Last Post: _Aka_
Information Questions regarding spline colliders and collisions with rigidbodies Spyboticer 7 508 01-20-2025, 12:25 PM
Last Post: _Aka_
  Extrude mesh along spline. New and confused user GhostStalker 3 213 01-02-2025, 09:58 AM
Last Post: _Aka_

Forum Jump: