O'Reilly logo

Unity 5.x Cookbook by Chico Queiroz, Matt Smith

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Player control of a 3D GameObject (and limiting the movement within a rectangle)

Many of the 3D recipes in this chapter are built on this basic project, which constructs a scene with a textured terrain, a Main Camera, and a red cube that can be moved around by the user with the four directional arrow keys. The bounds of movement of the cube are constrained using the same technique as in the previous 2D recipe.

Player control of a 3D GameObject (and limiting the movement within a rectangle)

How to do it...

To create a basic 3D cube controlled game, follow these steps:

  1. Create a new, empty 3D project.
  2. Once the project has been created, import the single Terrain Texture named SandAlbedo (it was named GoodDirt in Unity 4). Choose menu: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required