Adding snakes and other physic aberations



Hello everyone,

I decided to add some animated elements to the game to make it more challenging and more fun. This will probably cause a lot of complications with the physic engine but this is an important feature of the game.

I started by working on a snake, for that I made a quick sprite (quick, not pretty)

Then, I started with what I thought was the cleanest way of animating it: a combination of skinned mesh, with the bones linked by hinge joints.

It was quite easy to do, until I got to the point of actually running the game:

If I just drop it on a cube, it works pretty well. 

But as soon as you start interacting with it, it has a tendency to stretch and to split itself into multiple dimensions:

I'm almost certain that this is not the way a snake is supposed to act, and I can't seem to find a way to fix it; it's probably possible with some fine tuning, but I'll just give up completely on the skinned mesh technique and use a multi part sprite instead.

So here's the new snake, chopped into parts:

This should result in a worse graphical experience (which shouldn't be too noticeable in this context), but less physics issues as it will be completely independent gameobjects jointed together.

so here it is on the test cube:

You can easily see where the snake is chopped up; this could be improved by adding overlaps between parts, but for now it will be good enough.

And here's me trying to break the simulation by playing with it like a cat (a 4-rotor cat):


For the final result I ended up limiting the hinge joints to -45,45 degrees, and used some capsule colliders.

I'll now need to work on more challenging animals such as giraffes, as well as trying to animate them with the hinge joint motor.

Thank you for reading this devlog, it is the first one I've ever made, let me know if you have any feedbacks or if I it was boring.

Get Chaos Storage

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.