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
  Absolute distance along spline for Shape Extrusion Module amutp 3 205 10-31-2021, 10:26 AM
Last Post: _Aka_
Question Generating a path from selected point to the beginning of spline on a closed spline? Zendariel 5 315 10-29-2021, 01:57 PM
Last Post: _Aka_
  Controller/Spline flipping object topquarkone 4 284 10-28-2021, 05:02 PM
Last Post: _Aka_
  How to find out whether the spline is self-intersected. mydayz 1 184 10-19-2021, 12:08 PM
Last Post: _Aka_

Forum Jump: