Animating polyline from point a to point b

Avatar
  • updated

How do you animate the polyline from point a to point b?

I use navmesh.calculatepath to get the corners then put that on the polylines points.

I animated the LineRenderer before but it's the performance and clipping issues made me switch to Shapes Polylines.

I can't seem to use the Vector3.Lerp  on the IEnumerator because it's only drawing one line and it's on reverse

Reporting a bug? please specify Unity version:
Reporting a bug? please specify Shapes version:
Reporting a bug? please specify Render Pipeline:
Built-in render pipeline
Avatar
Freya Holmér creator

the link seems down for me - are you trying to make a polyline reveal animation? if so, this code might help

also, you shouldn't call DrawShapes from a coroutine - there's information in the immediate mode docs on the dangers of doing so!

as for billboarding, set your polyline to Flat 2D instead of Billboard. or, in immediate mode:

Draw.PolylineGeometry = PolylineGeometry.Flat2D;

Image 747

Avatar
Row

Plus how can I do this on polylines without billboard always facing the camera?

Avatar
Row

I'm tring to use navmesh and polylines. Just like what this website does

Map of SM City Manila | SM Supermalls

Image 746

Avatar
Row
Quote from Freya Holmér

are you trying to animate a specific point in the polyline, or all points in a polyline? (what does your code look like?)

I'm trying to animate all points in a polyline. Like first it draws from a, then it continues to all points until it goes to b.

My code looks like this

Image 741

I passed the navpath.corners on the positions variable

I animate the polyline using this but I don't know why it animates only first pos

Image 744

Avatar
Freya Holmér creator

are you trying to animate a specific point in the polyline, or all points in a polyline? (what does your code look like?)