Time for action - importing your terrain in to Unity

  1. Fire up your copy of Unity 3D.
  2. Go to File ¦ New Project. Instead of where it says New Unity Project, type SketchUpLevel.
    Time for action - importing your terrain in to Unity
  3. check all the assets you wish to import for use in your project. If you check all of them it will take a long time to load them all up. For the project in this book, you should check at least:
    • Character controllers
    • Sky boxes
    • Standard assets
    • Terrain assets
  4. Click on Create and then wait a while for the project to install the assets.
  5. Click on the small folder named Standard Assets shown on the right-hand side. Right-click and select Show in Explorer (Reveal in Finder on Mac OS).
  6. You now have an explorer window open (Finder on Mac OS) which shows all the assets in the Project folder.
  7. Create a new folder now named Sketchup4Games. This is where you will save all the SketchUp assets created in this book.
  8. Right-click and select Send To (desktop). This will give you a shortcut on your desktop to help you find this again easily. On Mac OS, you can use Command Option, and drag the folder to the Desktop.
  9. Now, navigate to your Unity_Assets folder (where you have been saving your SketchUp assets) and copy everything to your SketchUp4Games folder.
  10. Go back to Unity and wait for your assets to import.
  11. Once you've got this set up, save your assets to your Sketchup4Games folder directly. They will import or update in Unity automatically.
  12. Sketchup4Games has now appeared in your folder list in Unity. Click on the little arrow next to it.
    Time for action - importing your terrain in to Unity
  13. The previous screenshot shows what has been imported into Unity. Click on the Map_Base object now, in the Inspector pallet, on the right-hand side of your window, and scroll down to the bottom. Here, you have a preview of your asset.
    Time for action - importing your terrain in to Unity
  14. It looks okay, so scroll up the Inspector pallet until you find FBXImporter.
  15. Enter 1 in Scale Factor and click on the Generate Colliders box. Now, scroll down and click on Apply.
    Time for action - importing your terrain in to Unity
  16. Now click the Map_Base icon shown in the screenshot on the last page, and drag it into the main viewing window.
  17. Enter the following figures in the Inspector pallet:
    Time for action - importing your terrain in to Unity
  18. Your terrain is now placed at the origin, and scaled correctly. Click on the Hierarchy tab.
  19. Notice that this list contains all the elements within your project. Click on the Map_Base item now.
  20. Point your cursor at the main window. Tap F on the keyboard. This stands for Frame selected, and will center your selected item in the screen.
  21. Click the hand icon at the top of the screen. Use the three mouse buttons and scroll wheel to move and zoom around. Unfortunately, these controls are slightly different to SketchUp and will take a little while to get used to.
  22. Finally, go to File ¦ Save Scene and type in Sketchup_Level. Click on Save.

What just happened?

You've imported your level into Unity 3D. Congratulations! From here on, creating a walk-around is a cinch. You changed some parameters to scale the mesh to retain the correct real-world dimensions you gave it in SketchUp. You set up a folder in the Unity project folder to hold your game level assets. Finally, you saved a Unity Scene file. Did you notice that this has now appeared in the project hierarchy in Unity? The Generate Colliders feature takes the mesh geometry and uses it to tell Unity where a physical object exists. So, in the case of your terrain, Unity will create a solid base for your character to walk on. If you didn't do this, your game characters would fall through the floor, and keep on falling forever...

That idea gives me the shivers.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.182.66