The Great Fleece: Building Character Animations and Movement

Aloha and welcome to day 26 of my quest to become a fully employable software developer and engineer in just 59 (ish) days!

So what shenanigans have I gotten gotten myself into today?

Well, I’m so glad you asked.

If you’ve been following my saga, you’d know that I’m diving into my second game: The Great Fleece. This game follows the heist of our stealthy protagonist Darren as he tries to purloin the contents of the vault in the prestigious Beatrice Auction House.

Last time, on The Great Fleece…

I was able to animate a full introductory cut scene with 14 different camera angles, transitions between them, and a full sound track with voice overs. And while it wasn’t easy, it was most definitely rewarding and quite fun to be frank. If you missed that, you can go ahead and view it here:

https://youtu.be/zYUdFccAqzA

Today’s misadventure takes us to the core of the game! I did some coding and animating in order to bring our plucky protagonist into this game world. This involved quite a bit of steps.

First, I needed to create a plane in the game in which Darren could navigate. This involved “baking” the floor of the auction house in order to create what is called a Nav Mesh Agent — basically a component the player will use to navigate the accessible world.

WOOSH! — Blue means it’s baked!
The name is Agent Mesh, Agent Nav Mesh.

Next, we needed to imagine our player in the simplest of forms:

Capsule Darren, reporting for duty.

I created a 3D object that would represent the player, to confirm that Darren would be able to navigate the Nav Mesh Agent, and not like, fall through the floor.

Next, I needed to create an input code in order to move Darren. In this case, I’m doing a point and click style movement, where the game detects a point left clicked on, and moves accordingly.

Pew pew, raycasting is so useful!

This step was accomplished using an API called Raycast, which as its name suggests, “casts” a ray from the camera to see where on the map the user clicked, then sets a destination based on that. This script was placed on the player and…

Voilla! Capsule Dar is movin’ and shakin’! Well, moving.

There he goes! But notice how the capsule Darren is clipping through objects. This was due to the objects in the game not being set to static, an easy enough fix by highlighting all the objects on the baked floor setting them to static objects, and re-baking the floor.

No cheating, Darren.

And there we go, capsule Darren is no longer clipping. Next in the process, I needed to set up the camera system using floor triggers in order to change the camera position based on where capsule Dar was in the room. Using a LookAt scripting API that would be attached to the main camera to accomplish a camera system that would move along the room with our player, without having to be over the shoulder, or first person.

Lastly, I had to incorporate Darren to his fullest potential, including a 3D model and animations. This included making sure he was the right scale, and resizing his colliders, and Nav Mesh parameters for obstacle avoidance. His animations for walking and idling had to be put into an animation controller which would direct when certain animations would play.

On the code side, creating a bool in order to switch true or false to when he was walking was easy enough, and after a bit of light coding which involved calculating distance between objects (super useful) in order to stop the walking animation which I set to stop when reaching less a float value of 1.

I was left with this:

What a brazen fella!

All in all, today I accomplished a bit, learned a lot, and am excited to move on to the ENEMY AI, mostly to put Darren’s ego in check. And that will do it for day 26’s update, thanks for taking the time to read all about it!

Till tomorrow,

-Ry

--

--

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