Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding a Control point Not working as espected
#1
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:
Code:
curvySpline.Add(cameraWorldPosition);

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.
Reply
#2
Hi,

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.
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Closest point From a Ray (a line), to the spline UsernameHed 5 190 07-31-2019, 03:57 PM
Last Post: _Aka_
  Change default settings when adding a point UsernameHed 3 139 07-31-2019, 11:03 AM
Last Post: _Aka_
  Debug message when moving over CP not working. funkd 5 248 07-12-2019, 11:15 AM
Last Post: _Aka_
  Point along Spline Ian@MrsWordsmith 3 297 06-21-2019, 03:50 PM
Last Post: _Aka_

Forum Jump: