Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding a Control point Not working as espected
Hello again.

Here is a screenshot where I try to explain everythings:
[Image: IEtlhoxWdsz_Capture2.PNG]

When I select my "Dolly 2" object, I have some editor scripting and some stuffs.
I have an object (the camera of my game), who are in this screenshot between the CP001 and the CP002.

When I click on the button "Add Key" in the inspector, I would like to add a control Point exactly in the position of my camera object (in the screenshot: it is the "Position where to add")

Here is how I have tryed to add my point:

and you see the result, it's not at the right position, and always at the end of the spline.

So, I have only 3 information:
- the Spline
- the position of my camera (which is a SplineController, always on the SPline)
- the type of adding: here another screenshot. I know if i have to add a point at the end, inside, or at the start of the spline:
[Image: IEtlAd33Pjz_Capture.PNG]
When I want to add inside the Spline: I can have the percentage of the SplineController. So I may find also the segment where I want to insert.

The weird thing is: even if i add a control point at the end of the spline, the position where the control point is created is not really at the same position:
[Image: IEtlNuzG0mz_Capture3.PNG]

So, it was a long post, I hope It's an easy answers, and I hope I explain well what I wanted.

When adding control points through the Add method, you will need to give as a parameter the CP's position in the spline's local space, not the global space. My bad the documentation does not state this clearly, I will fix it in an upcoming release.

To get the local position of a point in a spline based on its TF or its distance, use the methods Interpolate or InterpolateByDistance

The Add method inserts the CP at the end of the spline. You have other methods called InsertBefore and InsertAfter that you can use to insert the CP elsewhere.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.

Possibly Related Threads…
Thread Author Replies Views Last Post
  Adding OnSwitch event via Script NovoNG 3 67 01-09-2021, 05:25 PM
Last Post: _Aka_
  How to I get positions between control points dazz777 2 489 01-09-2021, 02:18 PM
Last Post: _Aka_
Rainbow Get nearest point to a world object jamesunity 6 1,372 07-16-2020, 10:46 AM
Last Post: _Aka_
  Converting spline collider hit point to spline position jh092 7 1,364 06-26-2020, 09:48 PM
Last Post: _Aka_

Forum Jump: