Generate a Snake-like body between two body parts

Hello,

I’m trying to develop a “snake-like” game with dog models in 3D. The idea is that the more treats you eat, the longer the dog boddy elongate.

So my plan is to cut the 3D model in half and find a way to join the two body parts together in game.
For the moment, I just use a capsule model that I instantiate along an array of Vector3 :

It kind of works but at a certain point it start to jitter so I’m looking about other possible ideas that may be used to achieve smoother results.

This is a list of ideas that I had but I have no idea if it’s something possible or not:

  • Use a spline rather than a Vector3 array ?
  • Procedurally generate vertices and triangles to reconstruct a mesh along that spline ?
  • Use a Line Renderer ?
  • Create a Shader ?

if anyone has ideas or suggestions, I’d love to hear them !

Thanks !

You could do this with rigging and bones. You’ll need to add lots of ring loops to the mesh around the dog’s torso and add lots of bones along its spine.

Agreed.

is unlikely.

You can set the spine bone of this dog to the longest length at the model stage. For every food it eats, set one more spine bone length to be the normal bone length.

Finally, perhaps you could also rely on ChainIK to achieve its movement.

This is the same mesh topology problem that you find in those “endless tunnel racer” games where they procedurally generate an endless ring mesh.

If you find a good one of those you can use it on your doggie.

Honestly, I kinda like how the capsules look above!

Thanks all for your suggestions, it realy helped me on my research !

I looked into the rigging idea but I’m not charmed by playing with bones and have a monstruous amount of ring loops on the model

I also looked for ways to create those “endless racer” games and that put me on the way of the new Splines system that Unity released in January !

Using my previous array of registered player’s positions, I managed to instanciate knots according to that, then create the mesh along the spline with the “Spline Extrude” Unity script

And voilà :


I can also easily control the resolution of the cylinder.

Now I still need to optimize my script for saving the player positions because for the moment it saves the player position on each frame, then update the position of each knots, meaning that the game start lagging the more I add knots to the spline… (issue that also apply for my fist post)

That is the most awesome dog snake I’ve ever seen! I LOVE IT! (I grew up with dachshunds…)

Then you’ll be delighted to know that you can personalize them !

Eye-opener! This effect is really cool

Hi Antoine, could you share the technical details with me? I’d like to follow exactly what you did to make sure I get the same result. Thanks!