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

Testing the PlayerController

Hit the Play button the test the scene. Clicking the left mouse button or A or X on the Touch controller will display a ray in the Scene window. Zombies that collide with the ray will die.

Everything is working well expect for two things:

  1. The zombies never attack the player
  2. Without visual feedback

it's almost impossible to tell if you've lined up your shot. So, let's address these last two things as we wrap up the project:

  1. Reopen the zombieController script.
  2. Inject the following functions at the end of the script. before the last curly bracket. to facilitate the zombie attack function:
private void OnCollisionEnter (Collision other) { // This code will initiate an attack when the player GameObject intersects ...

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