godot-polyliner
godot-polyliner copied to clipboard
Rethink Trail3D circular buffer
Trail3D relies on an array of fixed size to store the Transforms that make up its points, adding a new Transform every frame. Currently, the entire array is shifted one element back, element by element, to make way for a new Transform.
Instead of shifting the entire array element by element, we could have an integer that represents the head of the array, and just increment that integer, wrapping at the end of the array. Then you can just overwrite whatever that index points to in the array with the new Transform. Way simpler.