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
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
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()
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
  Skip Input Mesh if spline has too much bend Zilk1 3 5 09-27-2023, 09:45 PM
Last Post: _Aka_
  animating points on a spline Antonio 11 18 09-17-2023, 09:55 AM
Last Post: _Aka_
  Getting object on spline Position when Spline has coordinates larger than 2000 velikizlivuk 5 8 09-05-2023, 01:01 PM
Last Post: velikizlivuk
  Spline.Length not updated unless I add a point to spline (or modify it) first. _RicO 3 6 08-26-2023, 08:41 AM
Last Post: _Aka_

Forum Jump: