Drone Simulator

My Role: Front-End Programmer

My Work:

Dynamic 3rd-person camera – flies behind player, and will keep the player in view if they fly against walls. Also has an idle function that orbits the player.

Player movement – Fly forward/backward, up/down, yaw, pitch, and a roll maneuver, as well as a forward boost.

Rubber ball cannon – Pressing ‘f’ will extend a cannon from the bottom of the drone, which has a laser pointer and fire mechanic. The camera changes mode to view behind the cannon. Pressing ‘f’ again will retract the cannon.

Pick up/drop package – Flying over a package will prompt the player to press ‘e’, which will attach the package to the drone. Pressing ‘e’ again will cause the package to drop.

Drone health (battery) – Drone battery drains slowly as it flies. Running into objects will drain the battery, as well as being shot by pellets. Flying through batteries or drone towers will recharge the battery.

AI movement – pellet gun teens and cars/trucks use Unity nav mesh and a way-point system to move, which is why the cars barely obey traffic laws.

AI shooting – pellet gun teens shoot at the drone when in range, which drains the battery. Teens can be shot by the drone cannon which stuns them for a short time, complete with a cartoony stun effect.

Drone towers – act as bases for the drone to deliver packages to and to recharge.

Game manager – Credit to Colin Campbell as well, the game manager handles all the missions and objectives which make up the bulk of the game-play. Colin would program in the mission systems and I would hook everything (sound dub, next mission, and mission objects) up in the correct place and order. I also created the radio station and music system – pressing ‘page up’ or ‘page down’ will cycle to the next song.

Animation systems – Stephen Rodriguez, Cameron Kalmbach, and David Chiu deserve credit here. I imported the animations into Unity and programmed them to work within the Unity Animator. That includes the car shake, drone cannon, enemy movement, wind turbines, etc. The drone propellers are programmed to rotate based on player input, and the propeller sound pitches up and down with it.

Package beacons – a simple line renderer to cue the player where to go. It began as a giant arrow.

User interface – main menu, loading screen, and pause menu.

Sample Code

3rd-Person Camera

In the event the player flies to where they are up against and facing away from a wall, the camera should make sure the drone is still within view.

//uses the current or temporary camera position and returns a position that should place the player into view

Vector3 EnsurePlayerInSight(Vector3 cameraPosition){

 RaycastHit hit;

 if(Physics.Raycast(player.transform.position, (cameraPosition - player.transform.position).normalized, out hit, cameraDistance)){
  if(hit.transform.root.tag != "Player"){
  //Debug.DrawLine(player.transform.position, hit.point, Color.yellow);

  if(hit.transform.root.tag == "MainCamera"){
  //Debug.Log ("Hitting myself.");
   return cameraPosition;
  if(Vector3.Distance (cameraPosition, player.transform.position) > 3.0f){
   return hit.point - Vector3.forward;
   //Debug.Log ("Camera too close to player.");
   return cameraPosition;

   return cameraPosition;
  return cameraPosition;


And then little things, like how the drone engine sound pitches up and down with player control.

  droneEngineObj.GetComponent().pitch = 2.0f + (controlsAcceleration + controlsAscension + controlsBoostAmount * 0.5f) * 0.33f;