- Home /
Is there a way to slowly resize a line renderer?
I want to resize my line renderer so you can actually see it resizing. With the default resize (or rather setting of the positions), it instantly resizes.
Any way you can use time.DeltaTime or something similar?
PS. I'm using almost the same coding as mention in the Scripting Reference
Answer by Joshua · Apr 14, 2011 at 10:50 PM
So you want to 'slowly' go from one value (sizeA) to an other (sizeB). This is called linear interpolation - acronym-ed lerping.
Unity has a build in Lerp function for many values. If you want to go from one integer to an other in a set time it looks like you should use Mathf.Lerp
Goodluck.
"But how can I combine the Mathf.Lerp with a raycast hit.distance? The line resizes to the hit.distance "
That means sizeB is hit.distance.
var sizeB = hit.distance;
use this as the targetsize in the lerp function.
Oooo... But how can I combine the $$anonymous$$athf.Lerp with a raycast hit.distance? The line resizes to the hit.distance
Your answer
Follow this Question
Related Questions
Bezier curver using LineRenderer 0 Answers
Creating a Ray Gun 1 Answer
LineRenderer lagging behind 1 Answer
Line renderer is not working for Perspective camera. 1 Answer
Smooth out a line renderer 1 Answer