top of page

Drones

Updated: Apr 21, 2021

This week I have been working on implementing the drone enemies

Vector3 fovRadius = eyes.gameObject.transform.forward * lookRadius; 

//This piece of code gets the radius of the enemy so this is how far the enemy can see, it gets the ‘eyes’ of the enemy which is just an empty game object and gets the z axis and the lookRadius which is specified higher up in the code, this is made public so it can be changed and adjusted in the inspector.

float distanceToPlayer = Vector3.Distance(player.gameObject.transform.position - eyes.gameObject.transform.position, fovRadius); 

//finds the distance between the player and the enemies’ eyes


float playerAngle = Vector3.Angle(player.gameObject.transform.position - eyes.gameObject.transform.position, fovRadius); 

//finds the angle between the player and the enemies’ eyes


Then if the player is close enough the enemies will chase the player and start shooting towards the player.


Comments


  • YouTube
  • Instagram
  • LinkedIn

Google Play and the Google Play logo are trademarks of Google LLC.

bottom of page