Posts: 7
Threads: 2
Joined: Jul 2022
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.
Posts: 2,146
Threads: 95
Joined: Jun 2017
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.
Posts: 7
Threads: 2
Joined: Jul 2022
Thank you for message.
I want the spline to not change at all.
(And I am using Bezier).
Posts: 7
Threads: 2
Joined: Jul 2022
07-23-2022, 10:21 AM
(This post was last modified: 07-23-2022, 10:23 AM by Beaver_Boy.)
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);
Posts: 2,146
Threads: 95
Joined: Jun 2017
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.