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
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  SplineController Ignores Follow-Up and Chooses Wrong Spline Josenildo 7 2,585 07-29-2025, 09:15 PM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 7 4,219 07-13-2025, 07:11 PM
Last Post: _Aka_
  Is there a way to get the position of each ControlPoint in spline by API? Chanon 1 1,553 06-07-2025, 09:44 AM
Last Post: _Aka_
  Filling a closed spline dynamically rickgplus 1 1,442 04-16-2025, 08:56 AM
Last Post: _Aka_

Forum Jump: