11-20-2019, 01:37 PM
Basically, her is how to do it:
https://www.dropbox.com/sh/8k5uwhirs13qq...J0nja?dl=0
Please do not use the files from dropbox to replace your own Curvy Spline files (files of the same name in the Curvy folder), since the drop box files are based on an old Curvy Splines version. Just copy the GetNearestPointTF and GetNearestPointF methods that accepts a ray as a parameter, such as:
public float GetNearestPointTF(Ray ray)
public float GetNearestPointTF(Ray ray, out Vector3 nearest)
etc
Was my answer clear?
Have a nice day
- Get the direction of the ray representing your click. See Unity's API for that
- Get the nearest point on the spline from your ray, more on that at the bottom of this post
- Get the TF of that nearest point. If you ask what is TF: https://curvyeditor.com/documentation/splines/start#units
- Create your controller and set its relative position to that TF
https://www.dropbox.com/sh/8k5uwhirs13qq...J0nja?dl=0
Please do not use the files from dropbox to replace your own Curvy Spline files (files of the same name in the Curvy folder), since the drop box files are based on an old Curvy Splines version. Just copy the GetNearestPointTF and GetNearestPointF methods that accepts a ray as a parameter, such as:
public float GetNearestPointTF(Ray ray)
public float GetNearestPointTF(Ray ray, out Vector3 nearest)
etc
Was my answer clear?
Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.