60 days to become a game developer. Day 36.

Hello! Here is a recap Day 36 of my 60 day challenge to become a Unity Game Developer :)

Take a look:

Image for post
Image for post

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.
Image for post
Image for post
By baking the floor, the character knows where it can and cannot go

Somehow I missed this step when going through everything which caused me to have this error:

Image for post
Image for post

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:

Image for post
Image for post

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.

Image for post
Image for post
The code above instantiates a cube at the mouse click position.

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).

Image for post
Image for post

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.

Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store