Finding Footing for Proceedural Animation

32 Views Asked by At

About three to four months ago, I began working on a video game with a couple of friends and decided that procedural animation would work best. After a couple of days, I was able to get a rig working that would bend the legs of a humanoid figure so that they connected correctly at the torso, knee, and foot respectively in the same way a human's would. However, when I tried to make the feet move, I had trouble finding the correct angle for the foot to be at when landing on the ground.

At first, I tried making the feet find the top point of the ground it should be sitting on, and then I would find the angle the foot should be at by asking the ground what its slope is, and then angle the foot to match. But I what do you know, the ground does not have a consistent slope, and if the foot happens to land on the conjunction of two pieces of ground with diffrent slopes, then with the code I had written before, there would be clipping.

I posted a question on Math Stack Exchange, asking for help with this problem. I recieved an incredible answer from a user named YNK, but I missed several problems with my question and diagram.

Specifically, in the diagram below (which I used for my stack exchange question), ∠ADE is not necessarily 90 degrees, ∠ABC is not necessarily obtuse, and there may not be only two ground lines to deal with (FG is the foot). These issues arose in the order I have listed them, with the first causing me the most problems.

For the obtuse ∠ABC, right ∠ADE, and FG where F is on AB and G is on BC what is the length of DE, where E is the bisector of FG

Having read through the answer given to me by YNK, however, I decided that he had given me enough of a push to solve those issues myself. I enlisted my dad for assistance, and we have been at it for around three days now (in our free time of course). I have decided on two possible solutions to this issue:

  1. Solve the new math problem, where the terrain is made up of any number of lines.
  2. Make a custom level editor so that I can build the terrain with lines, and then have the computer translate that to a Fourier Transform, which I should be able to use in conjunction with calculus to find an approximate footing.

Solution 2 is overly complicated, so I am leaning towards solution 1, but I am stumped.

Diagram I stole from YNK

In the above diagram (which I stole from YNK), all the known information is red. I have realized that dispite the fact that there may be any number of different lines I need to deal with, there will always be exactly two points of collision that I care about. Any other collisions that happen are irrrelevant (as long as there is no clipping), so once I find the two lines I care about colliding with, I can throw the other lines out of the equation.

Unfortunetly, nothing I do from this point works. I can get close using trig, but I'm always missing one piece of info that I need. Thanks in advance for the help!

0

There are 0 best solutions below