Hello! Here is a recap Day 36 of my 60 day challenge to become a Unity Game Developer :)
Take a look:
May not look like it but that little capsule is my player!
Here’s what’s going on….
First, I needed to setup the floor through a process called “baking” so that boundaries are set as to where the game characters can and cannot navigate.
This is done through the navigation window by:
- Finding the game object- in this case it was a floor collider.
- While the game object is selected, pull up the navigation window by selecting window>AI> Navigation which should pull up a window like this. Then click bake.
Somehow I missed this step when going through everything which caused me to have this error:
If you get this error too, make sure to go through and double check that your floor or game object is properly baked. It should turn blue like the image shown above.
After that I learned about raycasting! I heard about raycasting originally from a few teammates who used it in their space shooter game but I myself had never used it. I can certainly see how this can be applied in many differnt ways.
From the docs:
Basically, raycast is a 3d line that detects an intersecting collision. In this case it is used to return back the position where the mouse was clicked.
Finally a NavMesh agent was added to move the player to its destination. We do this by first getting reference to the NavMeshAgent then setting its destination to the raycast position (listed above as hitInfo.point).
Other things I worked on:
- Polished up the cutscenes.
Today I’m working on finishing up my player behavior. Excited to continue to learn more about the code behind these 3d objects!
See you later.