Tutorial 3
In this week's tutorial, we made a simple script to spawn a enemy where you click on the terrain, and we made the enemy follow the player.
A raycast detects all colliders from the origin towards a set distance (or infinity), and can return the colliders and the points of collision. We used a simple raycast script to return the position that we clicked on the terrain. Upon a click, a ray is cast from the camera towards the direction of the click, and then returns where it hit the terrain. An enemy prefab is then instantiated at that position.
The enemies use the NavMesh, a map of accessible surfaces (with adjustible parameters). Each enemy is a NavMesh agent, enabling them to use the NavMesh to go towards the player transform. (The moving box is a NavMesh obstable, meaning that NavMesh agents cannot navigate there.)
I made some adjustments to the code so that the enemy will move towards just infront of the player based on the direction and speed of the player as well as the distance between the two.
UTAS KIT207 Portfolio
Portfolio content for the KIT207 Game Design and Production course
Status | In development |
Category | Other |
Author | Sutherwin |
More posts
- Tutorial 5Apr 13, 2024
- Self Study 5Apr 13, 2024
- Game IdeasApr 04, 2024
- Self Study 4Apr 04, 2024
- Self Study 3Mar 22, 2024
- Tutorial 2Mar 22, 2024
- Self Study 2Mar 14, 2024
- Tutorial 1Mar 14, 2024
- Self Study 1Mar 07, 2024