Drawing a path


I would like to draw the path of an entity as it moves. I don’t know the path of the entity ahead of time, so I need to gradually update the path line on real time as the object moves. I can’t pre-load the entire path ahead of time, as is done in many examples.

I’m trying to use a polyline to do this. I save an array of the entity’s path which I update with new positions as the entity moves, and then set the entire array as the polyline ‘positions’ member on every frame. However, this causes the polyline to momentarily disappear and re-appear every time the positions array is set. It also slows down the program, and makes the camera shake around if it is tracking the entity.

Is there a better way to do this?

Thank you

Hi Jack,

Try a CallbackProperty or a SampledPositionProperty. Both of these will mark the position property as not constant and will handle updating the positions array in a more reasonable way.