This week I went back to work on the tongue.
Since I was generating a new mesh for every frame of the animation, the tongue took a lot of CPU time. This technique is not necessarily bad, especially if you want to render something that can't be done through traditional ways of in-game 3D mesh animation, but that wasn't the case. To speed things up, I'm generating the tongue only once, on the start of the level, but instead of creating a regular static mesh as before, I'm adding bones to it, in other words, creating an animated mesh.In computer animation, there is a technique called skeletal animation. This technique is used by constructing a series of bones, sometimes referred to as rigging. Each bone has a three dimensional transformation which includes its position, scale and orientation. Each bone in the skeleton is associated with group of vertices, as the bone changes its position, rotation, and scale, so do the vertices that are associated with it. My original idea was to create the tongue in some 3D Modeling tool, but since I already had the algorithm for generating the tongue mesh, adding bones to It wasn't so difficult, and it gave me freedom to easily determine the number of bones, vertices and triangles that I want to use for the tongue.So what did I get with this change, you're asking? The tongue actually takes near to non resources, which is a great improvement over the previous version, which caused some serious framerate fluctuations. Everything ran in real-time, even with the video recording tool, but it would be foolish to expect from everyone to have a Core i7 in their machine.Additionally, I improved the tongue curve algorithm to get a smoother result, and made the tongue pointy at the top.These shiny diamonds were created only for your amusement, since I had to record something new, but most of the work I did this week isn't visible :D