For this weeks work I began by looking back at the problem I had in the previous weeks work. This was moving the raycast up so instead of shooting out from the AI's feet it is from his eye level. I was unable to find why the errors were showing up and couldn't find a way to get it to work. I will arrange a meeting with Chris when we are back after Christmas to discuss the problem and how I can fix it.
Next I started to implement the hearing for the AI. I began by looking at the navMesh documentation (Unity, 2017) as I've never used it before but I am using it to calculate the distance the sound was travelling. This is a system that I saw Unity use during their 'Stealth game tutorial' series (Unity, 2013). Once I saw this I felt that this would be the best system to use as it helps with making sure the AI can't hear the player through walls. Learning how to use it now is beneficial as I will also be using it for the AI navigation as well. I managed to get it working so that it would calculate the distance the sound travelled however I was having a strange problem where the distance would constantly increase however neither the AI or player character were moving. I spent several hours worth of work trying to figure out why this was happening as both transforms were not changing and no code was changing any of the variables. I eventually found that in the code the AI's Y value was changing as if he was falling through the world but his transform in the inspector was not changing. I narrowed the problem down to the navMesh agent on the AI and fixed the problem by turning off the auto stop check box.
As I am now going into the Christmas break I am unsure on when I will be able to get work done so will blog whenever I make any progress (Until I got back to University where regular weekly blogs will restart). This will not effect my milestones as I previously planned for this. Ideally I will have the hearing set the players alert status (Similar to the sight does) done by the time I go back to University.
References
Unity (2017) navMesh documentation. Available at: https://docs.unity3d.com/ScriptReference/AI.NavMesh.html.
Unity (2013) Stealth game tutorial. Available at: https://www.youtube.com/watch?v=mBGUY7EUxXQ.
No comments:
Post a Comment