Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Gradually rendering paths
#1
Hi! Smile I started learning Curvy recently, and I need help figuring something out.

I have a 2D top-down project where I render paths along splines on a map screen. Currently, I use CurvyLineRenderer to generate simple solid lines as paths on the map.

I want to be able to render paths gradually from 0% to 100% of the spline. I thought of subdividing control points very finely, and turning CurvySplineSegments visible and invisible, but that would be choppy and probably inefficient. Is there a property of the spline or the renderer that I could set, that would make the path render up to X%? If so, then I could use it in a tween. Can you advise me on the best way to go about this?
Reply
#2
Hi,
Curvy Line Renderer is basically just getting points from a spline and feeding them to a regular Unity's Line Renderer.
In CurvyLineRenderer.Refresh, you have this line that gets the spline's points:
var vts = Spline.GetApproximation(Space.World);
(sorry for the poorly named local variable)
that variable is an array. You can do whatever you want with it, like reducing its size.
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
Hi Aka! Thanks a lot for the quick and informative response!
Reply
#4
You are welcome
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
  rendering a road with junction dazz777 3 1,227 07-12-2019, 11:19 AM
Last Post: _Aka_
  One generator for multiple paths justinms66 10 6,220 05-30-2019, 03:48 AM
Last Post: Horibe
  Referencing Paths in Editor johnnemann 2 3,147 06-15-2016, 01:43 PM
Last Post: Jake
  Generating Paths at Runtime momothemonster 3 4,307 10-16-2015, 06:49 PM
Last Post: momothemonster

Forum Jump: