2
\$\begingroup\$

Recently I've been trying to create a controllable fish character. The game is 2D and top-down.

My two approaches are:

  • Skeletal Animation, which is versatile but looks too robotic. For example, no matter how hard I turn, the fish has the same turning animation.
  • Procedural Animation, which I implemented using a line renderer following a tutorial from the channel Blackthornprod. It is very close to what I want, the fish is dynamic. The problem is that the fish loses all form when turning, some parts get thinner while some parts get thicker. The other thing is that it's hard to make it work with different types of fish sprites.

Here is an example, the black fish is animated using bones and the animator. The white fish is procedurally animated using a line renderer and the material with the sprite as a texture: [fish swimming gif2

I want to be able to move the upper part of the fish, while the tail follows in a chain-like manner. Preferably avoiding line renderer as I'm not too comfortable with the pixelated edges and needing to loop through hundreds of positions to animate only one fish.

I would love any suggestions and I'm thankful to anyone who takes the time to help me!

\$\endgroup\$
4
  • \$\begingroup\$ Hint: you can move bones procedurally too, such as choosing a blending weight between a slight-turn and hard-turn animation, getting something intermediate between the two. You may want to show examples of the problems you're having with each method to help target fixes at those issues. \$\endgroup\$
    – DMGregory
    Jun 11 at 12:18
  • \$\begingroup\$ I coded this app for programers who cannot draw: youtube.com/watch?v=m72AlW-YADQ maybe this could help you as well? \$\endgroup\$
    – mourad
    Jun 11 at 18:11
  • 2
    \$\begingroup\$ @mourad It's not immediately obvious what your application does or how it would help the OP. It would be better to explain how your application might help the OP, so your suggestion looks like more than mere linkspam advertising. \$\endgroup\$
    – Kevin
    Jun 13 at 23:45
  • \$\begingroup\$ yes sorry for the bad comment! I wasn't trying to promote my app here but I see many programmers struggling with art. So basically you use bones in blender to animate and you export it to 2d (I suppose OP is doing 2d?). My bad :-( \$\endgroup\$
    – mourad
    Jun 15 at 5:47

1 Answer 1

1
\$\begingroup\$

A solution was using the skeletal animation approach and adding inverse kinematics (let's call this IK) to the tail.

I made it so the tail IK wouldn't rotate with the body which meant that the tail IK wouldn't be affected by the rotation of the body. Then during the movement, I simply rotated the tail IK slowly towards the body.

tailSolver.rotation = Quaternion.RotateTowards(tailSolver.rotation, upperBody.rotation, lerpSpeed);

Here is an example of the animation using this approach:

Fish movement

\$\endgroup\$

You must log in to answer this question.

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