I am building a system where I need to store the path that the player takes through the world, and then redraw it in the scene after a certain period of time.
Could anyone help me out here? I have tried storing the point the player is at when the scene updates in a linked list, and that worked but I don't know if it is the best way to do it, or how to redraw the path that they have taken through the scene.
Thanks for your help in advance!
A LinkedList is a good choice, regarding the data-structure.
Adding new points costs O(1) and iterating through all points to draw them O(n).
How should the path look like? Simple lines between the points, a curve or something fancy like a path of flowing particles?
Thanks for your reply.
I was hoping for a thin solid curve. Not sure if this is possible or not though? If not lines will be fine.
For a line you could use: com.jme.scene.Line
Line subclasses geometry and defines a collection of lines. For every two points, a line is created. If mode is set to CONNECTED, these lines as connected as one big line.