Mesh Deformation and Animation Adventure



Good Morning,  or maybe Good Afternoon by now, or Good night!

Regardless, welcome  all!

I am Ethan Behar aka DuxClarus. I am one of the three programmers that helped create Roomies! It was a great experience and I'll get right into what that experience was for me.  DISCLAIMER: I totally just woke up, made coffee, and started writing this so please excuse any typos.

First off, to make a little sense of why I was animating. Initially during our brainstorms Friday night or even before that at our lunch pre-Game Jam meeting we all expressed aspects of game creation we wanted to get our feet wet with. I knew we were using Unity so I immediately jumped in and said I want to work with animations. So that's why I was mainly animating for this project.

Originally I wasn't thinking mesh deformation I was just thinking using the Unity Animator. But character design happened on Saturday and these blobby characters came to being and Kevin and Jon suggested the mesh deformation.  At first I was like "crap... how do I do this" but at the same time I was excited to enter a realm of programming I've barely scratched before. Jon had suggested a quick tutorial I could use to get started: https://catlikecoding.com/unity/tutorials/mesh-deformation/. Thank you catlikecoding! This tutorial was great for a starting point. So I jumped right into it and before I knew it I had some deformations going on. By this time it was the early afternoon of Saturday and I just coded mesh deformation. My next step was how could I get this roped into the animation system I was going to set up. 

For those that didn't read the tutorial a real quick explanation of it. The mouse input would ray cast against a mesh and at the collision point the code would deform the mesh based on a arbitrary force value.  Clearly that wouldn't work for us. I needed a way to do this regardless of the mouse. The quickest solution I could think of was to mimic the mouse input. So my brilliant idea was to set up transforms around the character, simple empty GameObjects, and use those to shot rays at the character.  It was quick, dirty, and probably made no sense to animate a character this way but we were game jamming so as long as it worked I went with it. With my proof of concept in place I set up transforms around the body of the character and started shooting the character. This process helped me figure out where I could shot rays from to get certain deformation animations for walking and idling. Check out the video which visualizes all of this. You can see pink lines flash periodically at the character. These are a representation of the the rays. I used Unity's Debug.DrawRay methods to visualize them during this process. The state machine is fairly system, the states travel between Idle and Walking based on booleans. The animations as well are simple. The little white tick under the timeline is a method call to shot the rays to make the mesh deform and you can see keyframes for the four legs and hat which are animating normally. And lastly you can see the transforms I set up to shot the rays. These are referenced in code and I use their forward/right/up vectors to hit our cute little characters!

Here's a video of it in action


So that was basically my Saturday. I had a bad merge and lost the character prefab and had to rebuild it. If this didn't happen I might've been able to get more animations in or help Ryan and Dan in some fashion.  In the video you can see other states that we just didn't have time to fully incorporate. 

Sunday I set myself up to be the merge handler. Ryan and Dan were still cracking away at the UI and grid/movement code and I didn't have much to do. For those without a coding background a real quick explanation of this is: I made sure all of the code we wrote all came together without issues. At the tail end I also set up a bit of the UI.

So that was my Game Jam experience. As we continue with this project I have the following tasks in mind for the project. First, rework the mesh deformation so we aren't shooting rays at the character. It was fun to do this but I need to set up something more sensical for mesh deformation animations. Second, implement more states for animation. Originally we had a list that included (but not limited too) winning, losing, rooted, pushing, and more! But as you can see due to time constraints we only implemented two animation states.

Well thanks for stopping by and giving this a read. Please feel free to ask questions and leave comments!

Have a great day,

Ethan B.

Files

RoomiesGame_v0.1.3_OSX.zip 28 MB
82 days ago

Get Roomies

Leave a comment

Log in with itch.io to leave a comment.