Game Development Reference
In-Depth Information
Figure 5-7. Creating a GameObject hierarchy for adding universal first-person controls to a Player prefab
Note I've also overlapped the two First Person Controller objects in the scene, so each starts from the same
position. Since we'll only need one of these two controllers, depending on the platform, their overlapping
won't matter in terms of physics or collision. The other, unneeded, controller will be deactivated automatically
at level start (as we'll see soon).
Note Take care to position the mobile controller at the world origin (0, 0, 0). Due to its implementation,
the screen position of the left and right touch pads for mobile input are based on the controller's start position
in the world. If a different world position is used, then, the mobile inputs will be offset on-screen.
Next, let's rename the First Person Controller objects to differentiate the desktop and mobile
controllers. I've used the names DesktopController and MobileControls (see Figure 5-8 ).
 
Search WWH ::




Custom Search