Snake Struggle

We looked at all the creatures that we created for the previous specials and wanted to create more. Thinking a snake would be easy was a mistake. The problem didn’t come with the modelling, that was easy and it was modelled and textured in a short time.  What was difficult was the animation of it moving. Want it to sliver in a kind of ‘S’ shape and go around the level with a cannon on its tail. Shooting it at any Zombies that it can see, one of the best companions in the game.

snakeRender

Takling this sliver I created a rig that was using bone rotation with the root being at the centre of the snake to be able to arch the neck upwards when its shooting and spin the tail around before shooting. This didn’t work when trying to rotate the bones to match the S shape. The snakes body needed to pass through its own line and continue forward. Tried a few different ways to rig this and kept hitting a block where the snake would almost straiten out between keys breaking the S shape.

Rob tried another solution which was to programatically make the snake bones move in a frequency. This created a wave like structor to the animation but didn’t look like a snake following its own line. With no control over the head movement and would have to create a script to merge it to the animation of the snake shooting.

snakeSliver

So we were working late trying to solve this problem both went home and were still like what are we missing this should be easy. I started to think how I would do it in just an animation program without thinking about how to put it into a games engine. I would use a spline deformer in Modo or Maya (I use Modo 701) to create a spine like deformation and create the correct animation keys moving forward. The hardest thing to get my head round was that this kind of animation doesn’t transfer well or sometimes at all. I thought again how I can do this with bone animation and not with spine. Combining both techniques and made locators that follow a curve down then made the bones link to the position of each of the locators. The snake followed its own body and transferred to unity. It worked. One problem with this is that it created loads of game objects that unity didn’t need and the spline made it impossible for me to do a animation of it shooting. Thought about it a little and figured how the game engine uses the animation and how it can transfer between characters with the same bone structure and naming. Created a Modo animation of shooting in a separate file to the S animation with a totally different rig but with the same bone structor and only the necessary game objects. Imported both into unity and applied them both using unity’s mecanim system. Checked the blend to see if it work and it did. Sliver then curl up and shoot.

Rob was looking at the programming of the snake at the same time trying to make it sliver round the level using programming. He created a movement of each bone following each other which created a snake that was long and had no S shape to it but slivered round corners and other areas perfectly. Couldn’t blend to shooting at this point. That would require whole new script. It didn’t have the characteristics of a snake S shape and looked to see if we could give it more shape. Combining the frequency movement from the previous day. Still didn’t look right.

So we went for the animation method. This seems to work well with the snake slivering round the level and then shooting at zombies. The disadvantage of it is that it doesn’t move round objects as smoothly. Think we will in the future look at ways of combining both methods and create smoother more organic movement especially in corners. Looks good for now.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>