Snake movement with Spline IK

Snake movement with Spline IK

I am working on a game in Unity, and there is something like a snake movement I want to implement. After many thoughts and research I have come to the conclusion that I have to use a bones set which will be attached to a tracking spline tag in Cheetah.

Lets say that the spline is a circle and the snake is a parallelogram plane (with 5 sections).

The thing is that I can not find out how to properly set up my bones to produce a smooth movement. I have tried both with simple bones and with an IK setup but it seems that I am doing something wrong and the plane comes totally distorted.

I am attaching a tracking spline to each joint and record a keyframe for the start and end of the spline, with an increased step for each additional joint. I am also using the 3d solver for IK (2d does not seem to work).

Do you see any mistake in these steps?
 
I am working on a game in Unity, and there is something like a snake movement I want to implement. After many thoughts and research I have come to the conclusion that I have to use a bones set which will be attached to a tracking spline tag in Cheetah.

Lets say that the spline is a circle and the snake is a parallelogram plane (with 5 sections).

The thing is that I can not find out how to properly set up my bones to produce a smooth movement. I have tried both with simple bones and with an IK setup but it seems that I am doing something wrong and the plane comes totally distorted.

I am attaching a tracking spline to each joint and record a keyframe for the start and end of the spline, with an increased step for each additional joint. I am also using the 3d solver for IK (2d does not seem to work).

Do you see any mistake in these steps?

Hi,
I'm not really sure I understand what you are doing, but how about something like this rather quick test ? ( just run the animation first )
 

Attachments

  • Snake.jas.zip
    85.9 KB · Views: 493
Hi,
I'm not really sure I understand what you are doing, but how about something like this rather quick test ? ( just run the animation first )

Wow! Sometimes I admire the art-minded people... :icon_thumbup:

I need something much simpler though.
In the attached jas I have setup the movement of the snake on a circle (the plane flips not intentionally). It miss the bones to make it bend along the spline.
 

Attachments

  • snake.jas.zip
    4.8 KB · Views: 391
Last edited:
In the attached jas I have setup the movement of the snake on a circle (the plane flips not intentionally). It miss the bones to make it bend along the spline.

I need to think about all this and a possible solution but I'm afraid that's likely not possible as spline tracking is for a full object and not for only a couple of polygons.
 
I need to think about all this and a possible solution but I'm afraid that's likely not possible as spline tracking is for a full object and not for only a couple of polygons.

I think it must be possible. In a faulty setup I had left the plane free and just attached tracking spline tags to its bones (the last of which had an IK handle). The result was functional (it animated properly) but was meshed up because I dont setup the bones in proper way. I recorded keyframes on joints and not on tracking tags.
 
I need to think about all this and a possible solution but I'm afraid that's likely not possible as spline tracking is for a full object and not for only a couple of polygons.

Well - a simple rotation along a spline with a joint system should work. Maybe a few Poses along will work too.

Cheers
Frank

Aunt Edith says: "Cheetah3d has a SplineIK tag nowadays!"
 

Attachments

  • SnakeMove.jas.zip
    6.7 KB · Views: 399
Last edited:
Well - a simple rotation along a spline with a joint system should work. Maybe a few Poses along will work too.

Cheers
Frank

Thanks Frank. The disadvantage of this setup, however, is that it only works for a perfect circled spline. In my case there is an oval one. So, I think the tracking tags must be attached on the joints themselves, somehow...
 
Last edited:
You could just manually adjust the bones using a guide. I realize this means getting your hands "dirty" ;-)

Yes, I am already trying this (placing numbers instead of using the mouse to not break the symmetry). The problem is I am not sure about the proper steps, as I see some significant distortions in my results that make me believe I have been following a wrong practice.

By the way, for the IK setup I am following your tentacle guide here. For each joint, I put a tracking tag and record the (0, 1) positions on the spline, advancing these positions by a step to make it being a skeleton for the free plane.
 
Thanks Frank. The disadvantage of this setup, however, is that it only works for a perfect circled spline. In my case there is an oval one. So, I think the tracking tags must be attached on the joints themselves, somehow...

How about this, then ?
Take a look at the position parameter at Start and End of the animation for each joint.
 

Attachments

  • Image 3.jpg
    Image 3.jpg
    55.3 KB · Views: 1,057
  • Snake_on_spline.jas.zip
    9.5 KB · Views: 417
How about this, then ?
Take a look at the position parameter at Start and End of the animation for each joint.

François: Smart&effective.:icon_thumbup:

If it´s really just an oval shape you can do some brute force on it and group that scene and squeeze the folder. ( you don´t have that from me :p )

Cheers
Frank

Aunt Edith says: "Cheetah3d6.1 has a splineIK-tag implemented!"
 

Attachments

  • SnakeMoveScaled.jas.zip
    8.6 KB · Views: 339
  • GroupedSnakeMove.jpeg
    GroupedSnakeMove.jpeg
    42.2 KB · Views: 440
Last edited:
How about this, then ?
Take a look at the position parameter at Start and End of the animation for each joint.

Francois, this is exactly what I was trying to achieve! I am comparing my setup to yours to find out what I was doing wrong. :)


Frank, unfortunately my "oval" spline is more like a rounded rectangle so neither this trick suited the case. However, I realized how I can exploit the power of Folders in Cheetah3d. Thanks! :icon_thumbup:
 
Yes, I am already trying this (placing numbers instead of using the mouse to not break the symmetry). The problem is I am not sure about the proper steps, as I see some significant distortions in my results that make me believe I have been following a wrong practice.

By the way, for the IK setup I am following your tentacle guide here. For each joint, I put a tracking tag and record the (0, 1) positions on the spline, advancing these positions by a step to make it being a skeleton for the free plane.

The link to the tentacle guide is broken..:frown:
 
Back
Top