When I started working on the tongue for the first time, back in 2013., I was thinking about how to make the grabbing look awesome.
Even tho the frogs from the planet Earth, from whom our main character was inspired, do an amazing job with their tongues; It doesn’t look so good without the slow motion. (Don’t blink, or you’ll miss it)
Fly, or whatever else they are catching, just sticks to their tongue.
My idea was that the tongue makes a loop around the object, and then it ties itself.
When think about the solution for that, I quickly realized that I’ll have to generate the tongue from code, since making the model and animation for every grabbable shape would take too much time.
Today i got back to the problem, and finished it.
Since the tongue is generated procedurally, I can determine various factors from the code.
In the screenshot above, you can see three different loop-around counts. (6,3,1), and in the screenshot bellow I played with the distances from the loop-arounds.
How does it work?
The loop he makes around the object has been explained in my previous few posts, so go read those first.
Now for the “knot” itself, solution is pretty simple.
The points are placed around the tongue, from the EnvironmentCurve end point, towards the player character.
To arrange points in circle, I’ve used sin and cos functions.
To make the spiral I’ve added a slight position shift in the direction of the EndPoint->Player vector, to every new point created.
For tongue to spawn out of nowhere would look weird, so the animation had to be implemented.
Since the tongue is procedurally generated, animation had to be as well.
Animation can be split in three phases, and its mainly done with linear interpolation.
First phase is the movement towards the EnvironmentCurve, second phase is looping around the EnvironmentCurve with a bigger radius, and the final state is tightening.
When releasing, first phase is done backwards.
That’s all for today.
If you have any questions or opinions, feel free to leave them in the comment section.
You can subscribe to this blog via e-mail, by click this Subscribe link; Or you can follow FrozenPixel on facebook/twitter.
You can expect the next post, hopefully, tomorrow