# Snake simulation

This work is one of the way to create a snake wave movement animation by DOP context (research a simulation of snake`s locomotion by dynamic tools of Houdini). It is not just animation way It is simulation of natural behavior.

According to research snakes use synchronized muscle work for this movement and different body friction coefficients for forward movement, backward movement and sideways movement. Because how to simulate every muscle and flakes position is not clear for me so I have used a little trick with velocity (@v) to simulate fulcrums which the snake uses to move (you can see the fulcrums on the traces left by natural snake with this movement) exactly I removed negative value of @v.x and set to 0 sideways movement (@v.z) at these points. If I remove this external influence on velocity it is possible to watch why snake does not use this method to move on flat and smooth surfaces (like glass). Forward movement (like others movement here) is calculated due to body bending only. The snakeâ€™s body is a chain of packed Convex Hall primitives with different constraints they are used like muscles. Two wave functions for horizontal and vertical movement direct of constraint work (is possible change speed, amplitude,period and other). Changing these parameters I can get something madness or reverse movement which is used for some snake robot or forward movement. Of course I have used packed primitives and it is very easy convert to spline IK animation with bones.
It is not so controlled way of animation like spline animation but it is allow to create more natural animation more quickly.
https://vimeo.com/357377930
https://vimeo.com/357378295
https://vimeo.com/357379404

2 Likes

Nice work, it reminds me of my attempt to simulate a snake back in 2014 using Maya and nCloth, only to discover that the way snakes are able to move at all is because the friction on their bellies is stronger along one axis (side to side) than the other (along the body), similar to how skiing works; I think this was called â€śanisotropic frictionâ€ť which wasnâ€™t and still isnâ€™t supported in nCloth.

https://vimeo.com/273077264

Itâ€™s not clear from your description or video how you achieved forward motion, whether it involved this type of friction; what is the green visualisation referring to?

1 Like

I used rigid body dynamic for simulation, 4 constraints betwen each 2 segments are muscles, 1 constraint is pivot point, and a constraint that do not be allow to rotate in x axis (is usable for some start frames). 2 periodic function direct these muscles.
Green parts are parts of body that are lifted above the rest position (to get less friction) - it is helpful to understand what is happen. For forward movement: segments which are used like fulcrums do not have z velocity and negative x velocity to simulate these fulcrums (it show different between friction side by side or forward or reverse along body). This is visible in the BBC video: https://www.youtube.com/watch?time_continue=43&v=zEto1-ZTbd4
(some parts must be lifted and snake trail shows that some parts more press on ground and are used like fulcrums for movement).