I'm making a 3d snake game clone for studies and prettly much got everything to work, I have a 3d ground object surrounded by walls, and a snake head piece (cube). when you start the game 2 additional snake body (cube) are being added and follow the head in a snake like movement, every time you eat an apple additional snake piece is added.

I want instead of cubes to have a snake object (which I got already) my question is what is the approach to make the cubes act like the bones of the snake object and make the snake object get it's shape from it's "bones".

also maybe there's a way to add bones to the snake object I got in a program like 3dsMax ? and then make the bones act like the cube pieces I got in the game and it will work?

I also tried cutting the body of the snake object I got and adding each snake body cube the cutted snake body object but then it doesn't get the look I want (smooth snake that can turn in 3d) so I think the right idea is to have one big object that get it's positon and rotation based on smaller bone objects.

  • \$\begingroup\$ Minceraft meets Nibbles? Implement the object described in the answer of Shivan, i.e. using those cuboids to achieve the gameplay solution. Now, you don't need bones, but a somewhat carefully designed deformable linear object made out of a 3D spline that passes through the centers of the cuboids. You could then envelop the spline dividing it into small segments and making cylinders around the segments. If you wonder how to get some skin on that series of cylinders, perhaps you could use some local frames (Frenet-Serret). It's rather complicated, go with the cylinders first.. \$\endgroup\$
    – teodron
    Mar 1 '13 at 16:39

Well, here's my 2c.

  1. Having a single snake mesh in this context will be a lot harder to implement/maintain than having the modular cubes system. Think about it: initially your snake mesh has no joints (1 bone). When it eats an apple the mesh scales (on it's length axis) and needs to have 1 joint (2 bones - vertices on the mesh need to be re-assigned from 1 to 2 bones) etc.

  2. One way to do this is to have multiple meshes for each of the possible number of bones (like 1 mesh with 1 bone, one with 2 bones, one with 3, etc). Then you still keep your cube system only now the cubes are not rendered, and then each time an apple is eaten, you remove the current mesh and add the one corresponding to the new length of the snake. At the same time your cube snake evolves as well, and each time you do this you link each of the new snake-mesh's bone to each corresponding cube and voalah, the mesh's bones are guided by the cubes.

  3. Honestly what I'd do is:

-keep separate-cubes body style

-have 3 types of cubes: head, middle-body, tail

-size them so that they overlap and use some clever transparency on the textures to give a as-good-as-possible illusion of continuity.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.