Unity Geospatial Data
Welcome to the Unity portion of the geospatial data visualization tutorial! Make sure that you have completed the Data Gathering, Cleaning and Conversion portion first.
Open up Unity, and create a new project.
Click GameObject->Create Empty. Name it "Manager". On the right side, under Components select Add Components and select New Script. Name it ReadCSV. Paste the following code there:
We'll need a few things before we can visualize the data. First, a rudimentary csv parser, since Unity doesn't have one builtin. Luckily there are quite a few open source ones online. Create a new script and name it CSVReader.cs.
The next step is creating the sphere that we'll be using to represent meteorites. Click GameObject->3D Object->Sphere. Drag it down to the Assets section to create a prefab out of it.
We want to tell our Manager that this is the prefab it should use when instantiating the points. To do this, select the Manager in the hierarchy and drag the newly created prefab to the "Prefab" field in the script (ReadCSV) component.
Finally, we want to add the csv_file so that Unity can find it. To do this, create a folder named Resources, and import the csv_file.csv in it.
We are ready! Click the Play button, and wait for Unity to create all the points (can take ~20 seconds on slower machines).
To make the experience more interesting, we can make the camera rotate around the globe. To do this, attach a new script to MainCamera. Name it Rotate Camera. Paste the following code, which takes a center point and make the camera go around it.
Now drag the manager to the target field of the script, and set the speed to something low (I use 3). Enjoy the show!