i've just started to learn unity and i'm having some troubles to go ahead with my exercises. I need to move 2 cars using coordinates stored in a .txt file called "positions.txt". The cars have to move at the same time. Inside the "cartesian" list there are numbers which have to be splitted in groups of 4 (time, x, y, z).
I'd like to create 2 arrays for each car: a time array and a Vector3 array.
First of all, i need to read the file and store the numbers in the arrays. I found several options and i tried this one without success: https://allison-liem.medium.com/unity-reading-external-json-files-878ed0978977 Which approach should i follow?
Thank you.
File "positions.txt"
[
{
"id":"car_1",
"position":{
"cartesian":[
1,0,0,0,
2,0,0,2,
3,1,0,3,
4,1,0,6,
5,2,1,9,
6,2,0,11,
7,3,1,13,
8,3,0,15,
9,3,1,18,
10,4,1,20]
}
},
{
"id":"car_2",
"position":{
"cartesian":[
1,0,0,0,
2,0,0,2,
3,1,0,3,
4,1,0,6,
5,2,1,9,
6,2,0,11,
7,3,1,13,
8,3,0,15,
9,3,1,18,
10,4,1,20]
}
}
]