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
  Getting Distance from a World Point zorksox 3 5 04-16-2024, 07:30 PM
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 6 03-28-2024, 10:08 PM
Last Post: _Aka_
Bug Issues when working with in-place prefabs Sacryn 4 6 02-27-2024, 04:08 PM
Last Post: _Aka_
  Avoiding runtime GC allocations on control point position change Ell223 8 18 02-24-2024, 10:43 AM
Last Post: _Aka_

Forum Jump: