Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do you delete last CP in spline
#1
Hi just a quick question

How do you delete the last control point in a spline
Ive tried

Code:
newspline.Delete (newspline.ControlPointsList[newspline.ControlPointCount ]);

I've also tried last visible control point and last visible segment.

I just keep getting out of range exception error.

Cheers
Reply
#2
newspline.ControlPointsList[newspline.ControlPointCount - 1]
Arrays in C# are zero indexed, meaning that first element index is 0, and last of is the length of the array - 1
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply
#3
doh schoolboy error on that one ( one day I'll stop making them ), thanks anyway.
Reply
#4
you are welcome
Bonus info: IEnumerable have extension methods called First() and Last()
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Filling a closed spline dynamically rickgplus 1 231 04-16-2025, 08:56 AM
Last Post: _Aka_
  Disable a spline's gizmo when not selected or disabled. mikechr2000 1 286 02-03-2025, 09:34 AM
Last Post: _Aka_
Information Questions regarding spline colliders and collisions with rigidbodies Spyboticer 7 1,102 01-20-2025, 12:25 PM
Last Post: _Aka_
  Extrude mesh along spline. New and confused user GhostStalker 3 531 01-02-2025, 09:58 AM
Last Post: _Aka_

Forum Jump: