Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Point along Spline
#1
Hello, 
   I am really enjoying this tool. 

  Sorry for the question, perhaps there is something I am missing in the logic of how splines work. 

  What I am trying to do is place a debug gizmo along the spline at a normalised value. 

  Something like; 

Code:
Gizmos.DrawSphere( thisSpline.InterpolateByDistance(speedTriggers[i].distance), 1);

Where distance is a value between 0,1. 

Regards,
Ian
Reply
#2
Hi,
Here is the API documentation for the method you used:
https://api.curvyeditor.com/520/class_fluffy_underware_1_1_curvy_1_1_curvy_spline.html#a83da3c5d5f5c15dc60c703cd91735d22
By reading it, you will find what went wrong. You need to use Interpolate instead.
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.
Reply
#3
Ah perfect, I had tried that method but needed to start it with the transform;

Code:
Gizmos.DrawSphere(transform.position + thisSpline.Interpolate(unityTriggers[i].distance), 0.6f);
Reply
#4
The returned position is relative to the spline's local scope. You then need to transform it to the global space (a.k.a world space) using unity's Transform's methods
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
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_
  GO can't fit end of the spline GameDeveloperek4123 3 13 03-04-2024, 11:06 AM
Last Post: _Aka_
  Avoiding runtime GC allocations on control point position change Ell223 8 18 02-24-2024, 10:43 AM
Last Post: _Aka_
  Keeping a fixed spline length jh092 3 16 02-21-2024, 06:25 AM
Last Post: Primrose44

Forum Jump: