Hi.
What is the best way to store the positions for 1 second of around 50 gameobjects that are moving, and then clean it up after 1 second, and so on.
Dictionaries? Can they handle so many entries?
I need this for multiplayer lag compensation.
Thanks for help.
If you know the exact amount of positions (50 as you say) and that amount is not going to change, just an array. It’s the fastest. C#:
private Vector3[] positions = new Vector3[50];
Dictionaries can handle any number of entries, they are also very fast at retrieval. Each of your gameobjects should have a unique ID for the key. To keep it tight I would probably just store the transform.Position as Vector3 so you would be storing a assuming you use an int as an ID