Help with procedural animation of hexapod character (ant)

I am trying to make an ant player character in order to learn as much as I can about making things for Roblox. In the past weeks, I have learned Blender, made a model ant that I am happy with, and rigged it using RigEdit Lite.


I have done research on different ways of animating it, but I can’t decide on what to choose. I want to make the animation feel as good as I can make it, so I want to implement some sort of procedural foot placement with IK and a little bit of head tracking to make the ant behave organically. however, I am having a hard time finding resources that apply to animal players.

One idea I have tried is putting hinges, ball joints, and springs on a leg and then moving a point at the tip of the foot so the joints bend with the physics engine. It works well in build mode, but if I move the foot with test mode running, all of the joints freak out and it doesn’t look good at all.

build mode:



and after I run the game:

I don’t think that this is going to work, but I’m not sure what else I should try doing.

I also don’t know how I should do head tracking. I think that I could possibly use one of the tutorials that already exist, but I don’t know if I would still be able to animate the antennae and mandibles if the neck was controlled by a script.

I had a hard time deciding which category this belonged to, I chose art design support because this has animation, but its also scripting, so I might be wrong.
Edit: changed category to scripting.

That’s a pretty awesome idea you have to utilize the constraints system. It makes sense it would “bug” out though – and also keep in mind that if you’ve got six legs per ant, and a bunch of ants, that’s a lot of constraints to solve. Might lag your physics to hell.

I think simplicity is key here. Some observations from a ant walking reference to help with this:

  1. From the top view, the legs basically stay in a straight line
  2. Really, there’s only three joints that have to move:
    • The “shoulder” (i.e. your first Attachment), which connects to the body - but only moves side-to-side to pivot the arm back-and-forth
    • The first joint after that (the second Attachment), which moves the rest of the leg up and down
    • The joint after that (the third Attachment/the highest joint), which also moves up/down and mostly controls how close the leg is to the body
  3. Mostly an aesthetic thing, but I would make your ant’s body sit lower to the ground, and have its legs “elbows” stick high into the sky – sort of like its back legs currently do.

So, basically, we can just do some pretty basic math to figure out what angle each of those legs should be at.

The info we need is:

  • The position of the ‘root’ of the shoulder
  • The position of the ‘tip’
  • The lengths of the three leg segments. Not real segments, but rather these distances:
    • from the root joint (“shoulder”) to the first joint
    • from the first joint to the second joint (“elbow”?)
    • from the second joint to the end of the foot

From there, it’s a little bit of trig to determine the angles. I can help you out with the math if you need it.

But once you’ve calculated the angles, it’s pretty simple to just update the legs every frame.

3 Likes

Thank you! I thought about what I would do with the ants when I am finished, and one of my ideas is making a two-player exploring game like Unravel 2, in order to reduce lag. I’ve found a ton of useful videos and papers about ant walking, and I have made a test animation using those charts.


Because of time, I haven’t given the body motion yet, but I could finish it and stagger the foot timing to make it better. I don’t dislike my animation, but I would still like to learn how I could make the legs feel less robotic.
how can I measure the joint distances? What should the root and tip locations be measured in relationship to? And are there any parts I should edit in Blender before I get the measurements?

I published the game