Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Line Renderer between two objects on a spline
#1
Hi,

I am trying to get a line renderer to draw along a spline between two points of the spline.
At the moment, I create the objects on the spline at their relative positions (eg 0.3 and 0.5 along the spline)
I want the line renderer from the first object to start at that object and finish at the second object.
Currently, I can draw a straight line between the objects (see gif here: https://drive.google.com/file/d/1-aqOJ2Z...YN1TAX_xN/)

I imagine it would be something like:
  1. Get object 1 position on the spline
  2. Set line renderers positions[0] to object 1
  3. As the user scrolls across the spline, add another vector3 to the line renderers positions based on the splines relative position
  4. When the user has scrolled and added the second object, set the line renderers last position to the new objects position (again using the splines relative position)
Ultimately, I think I just need to be able to go to a relative position on the spline (eg 0.4) and get that as a Vector3 to put into the Line Renderers positions, but am unable to find the appropriate functionality to do this.

Any help is appreciated.
Cheers


Attached Files Thumbnail(s)
   
Reply
#2
Hi
The function you are looking for is something like this:
CurvySpline.InterpolateByDistance(yourRelativeDistance * CurvySpline.Length)
Did this answer your question?
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


Possibly Related Threads…
Thread Author Replies Views Last Post
  Curvy Line Renderer for UI Spline? gekido 3 6 04-04-2024, 12:56 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 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 14 03-04-2024, 11:06 AM
Last Post: _Aka_

Forum Jump: