Indiana Jones Travel Effect

I’m trying to re-create the travel montage we all know from the Indiana Jones movies - essentially, a line being drawn as you watch.

I can do the lines between my locations using line renderer, that’s simple enough. But how do I slowly paint that line? Is it possible with line renderer at all, or do I need a different approach ?

for example if you wanted to draw a line from point A( 0x,0y ) to point B(1x,1y), you would use the line renderer to connect from point A to a point C that you change overtime that moves from A to B. Point C would go (0.1,0.1) to (0.2,0.2) until it becomes (1,1).

In other words draw a line towards a moving position that gradually moves from its origin to the destination

That works for straight lines, but not for a path that consists of several points.

why not?

Not with that simple approach. I’d have to check which points are passed and build up the array dynamically. I was hoping for a simpler solution maybe with a shader or something.

a shader is not simpler than just checking a vector3 position

Again, I think I know what you mean, but given that I have a non-straight line with multiple points, how would your approach look like in code?

public vector3[] points;
public LineRenderer lineRenderer;
public float drawRate;
public int currentNextPoint=1;
public vector3 currentpos;
void Start()
    {
  lineRenderer.SetPosition(0, points[0]);
currentpos = points[0];
}
void Update()
    {
 
   
currentpos = vector3.movetowards(currentpos,points[currentNextPoint],drawRate);
       
lineRenderer.SetPosition(currentNextPoint,currentpos   );

if( currentpos == points[currentNextPoint]){
currentNextPoint++;
}

        }
    }

That’s an interesting approach. It just might work. Thanks.

1 Like