O'Reilly logo

Virtual Reality Blueprints by John Williamson, Charles Palmer

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

PlayerController script

Take the following steps to set up the PlayerController script:

  1. Select the Player GameObject and add a new script component. Name the script PlayerController.
  2. Drag the PlayerController script from the Project folder to the Project/Scripts folder for organization.
  3. Double-click the script to launch it in your editor.
  4. Remove the Start () function, as we've done in the past, and edit the file to match the following script:
using System.Collections;using System.Collections.Generic;using UnityEngine;public class PlayerController : MonoBehaviour { 
Vector3 hitPoint = new Vector3 (0, 1, 0); 
 
void Update () { // This statement checks to see if the primary Fire button has been pressed if (Input.GetButtonDown("Fire1")) { Shoot ...

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