2
\$\begingroup\$

I have played around in Cocos2D-X and I think I understand the limitations of sprite-based animation fairly well.

I want to have a game with some characters curling and extending a tentacle which varies in length and amount of curl depending on the terrain.

Maybe imagine a sloth swinging from a tree but with arms that stretch at times (Gumby character?).

Is there a name for such a technique?

Would this be a variant on Animating Bezier Curves as seen in Jason Davies's example or discussed in this blog on tweening control points?

I'm a very experienced polyglot programmer but relatively naive in games and graphics.

\$\endgroup\$
3
  • \$\begingroup\$ You did appear to be trying to avoid it, but you were still asking "which technology to use". Those types of questions aren't on topic here, and ultimately dilutes this question. \$\endgroup\$
    – House
    May 18, 2016 at 15:47
  • \$\begingroup\$ Note that your edit weakened my question because I don't CARE which technology I use - I want to know how to do this technique in SOME technology. How on earth do I ask that kind of question without someone diving in and "helping" me? \$\endgroup\$
    – Andy Dent
    May 23, 2016 at 12:38
  • \$\begingroup\$ I disagree, removing your questions about which technology you can use opens this up to have answers provided at a higher level. Since you're more interested in the technique and not the implementation, it's best to avoid asking about a specific technology. \$\endgroup\$
    – House
    May 23, 2016 at 13:28

3 Answers 3

3
\$\begingroup\$

Since you're referring to s 2D sprite based game, I would use sprite segments to create the tentacle.

Each section inherits the rotation angle from the parent and adds a bit of angle of it's own. Each section n is calculated as

section[n].position.X=section[n-1].position.X+cos(section[n-1].angle)*sectionlength;
section[n].position.Y=section[n-1].position.Y+sin(section[n-1].angle)*sectionlength;
section[n].angle=section[n-1].angle+extraangle;

Now by altering the angle for each section you can make the tentacle curl. Add sections or stretch the section length (scale the sprites) you can vary the lentgh of the tentacle.

\$\endgroup\$
6
  • \$\begingroup\$ Would that still provide a smooth shape looking like one continuous body? I'm going for really smooth stretching and curling animation as a core part of the game play. (It works nicely on my paper sketched "flipbook"!) \$\endgroup\$
    – Andy Dent
    May 18, 2016 at 16:36
  • \$\begingroup\$ Depends on the number of sections, but yes. There are some examples in Spine that use the technique. You can make it flow much like the tail of the 1st boss in R-Type. \$\endgroup\$
    – Felsir
    May 18, 2016 at 16:41
  • 1
    \$\begingroup\$ Great series on the topic \$\endgroup\$ May 19, 2016 at 18:03
  • \$\begingroup\$ Indeed the part where forward kinematics is explained shows a simple 3 segment tentacle, using the technique. Thanks for adding it. \$\endgroup\$
    – Felsir
    May 19, 2016 at 18:33
  • \$\begingroup\$ I was originally leaving the choice of technology open but some "well-meaning editor" took that out because that would make it a question of "which technology to use". Sigh. So, I'm NOT wedded to using sprites. Regardless, Spine (from esotericsoftware.com) does look very cool. \$\endgroup\$
    – Andy Dent
    May 23, 2016 at 12:37
0
\$\begingroup\$

It seems that Soft Body Physics comes close, particularly as seen in Skeel Lee's work with goal and surface springs and Pressurized Soft Body with Local Deformation.

Note I found the above following the answers on Dynamic body implementation

\$\endgroup\$
0
\$\begingroup\$

Based on @felsir's answer, yes it looks like Spine is probably the answer. A graphical modelling tool, it includes exports to a number of game engines.

Relevant technologies it includes, which gives me the bibliography I was searching for, are:

  • Free-form deformation so a model defined in a mesh can be distorted, combined with Weights (aka Skinning) to attach images to the mesh.
  • Inverse Kinematics to help work backwards from the range of motion desired, to define joints needed
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .