Profile image

How to make a mech walk.

19.0k Axartar  1.5 years ago

How to make a mech.

Intro: my qualifications.

I have made several mechs and while they aren’t good particularly I feel the entire building aspects can be difficult to break into, so I want to highlight methods to make walkers.

Step 1: the design.

Build a skeletal frame with joints, these joints should be a form of rotator, it doesn’t really matter too much which rotator type it is. But for humanoid mechs, it should be where joints on a human would be.

Step 2: detail.

This step can be put later, but personally I like to do it now, this point is subjective, however make sure decor can accommodate the movement of the mech. Either by turning off collisions or making sure it’s out of the way.

Step 3: movement in theory.

This part isn’t hard but is tedious but I recommend splitting the motion of the leg into 5 stages. You can use a video of a person/creature walking if it helps.. You can do more than this, personally though I believe 5 captures the rough movement of a leg. You’ll want to focus on a single leg with the intervals between the 5 stages roughly equally spaced.

The basic equation for a hip joint would be sin(Time*90) however this only waves the leg back and forth, it’s not really helpful. Breaking this down for less maths experienced people, Time*90 multiplies the game time by ninety, and then takes the sine of this, due to how sun works with degrees, 90 would have an output of 1, 180 an output of 0 and 270 an output of -1. This is basic sine graphs in degrees. Now I would recommend either booting up an online graphing calculator or drawing a graph the key numbers on the x being 0,90,180,270,360.

Next have a look at your table of key points for the leg, knowing that an input of 1 will get you the maximum value forward rotation, how far do you reckon it is on a scale of -1 to 1. If you start with the beginning position of the leg this will be at 0, the value for the input you just found will be the Y-axis value for this coordinate. Repeat this with each step of the legs movement.

Now you should have points which ideally an equation would fit through perfectly, however that’s unlikely so you want the closest possible fit. This will probably take many many goes, however personally I start with a cosine graph, and start adding other multiples of sin or cosine graphs. The only other point I should make it it should repeat every 360 degrees(2pi radians), or the movement will only work half the time or less. Quick note: a multiple or variation of sin(Time*90) is what makes the leg move and will be needed for conducive movement, however you can have different multiples/factors of 90 to alter how fast or slow the leg moves.

This may be painful but eventually you will have what is hopefully a reasonably smooth well fitting graph.

Now, unfortunately life isn’t that easy and now you have to repeat the process for the knee joint and the ankle joint. Once you have these equations make sure to put them into the input of the rotator in overload.

Step 4: did you think it was over?

Now. You have one leg working. Buttttttt that won’t move a mech, and you can mirror it, however that just gets you a crazy bunny hop/worm. So for the leg that you just mirrored across, everywhere in its equation where you used (Time*90) you have to add 180 to it: (Time*90+180) this in more physics-y terms maximises the phase difference.

Now. This should have you a walking mech. If not simple sin(Time*180) for the hip, and cos(Time*180) for the knee and ankle (invert the ankle) will work.

Step 5: the moonwalk.

The moonwalk is usually a condition I encounter with the knee joint when it starts dragging its foot forward, overall making the mech walk backwards. This can be fixed by redoing the equation with a more exaggerated tuck. Or if that sounds dull, perhaps changing the foot length, or inverting the knee joint.

Step 6: stable.

Now while it walks, you can’t stop it at all, so first make sure to put your hefty equations in brackets and multiply them by an activation group, so they can be turned off. (The clamp01 makes sure it can’t go below zero.) for example: (…..)*clamp01(Activate1). This is the easy part. The next part I honestly don’t truly know fully myself.

Gyroscopes. They are vital for keeping a biped upright. So why don’t you just overload a gyroscope to have millions of times more stability than it was meant for, because it doesn’t really work like that. My most stable configuration had 4 gyroscopes all at the centre of mass, each with its own rotations. One facing left, right, forward and up. These worked better however it will be different for each mech. You will want to add Yaw to a gyroscope to help turn the mech.

Step 7: This is the best I can really do.

I tried to dissect the important parts of maths to look at, like the shape of a sine/cosine graph. And decided to avoid radians because simple planes works in degrees I’m pretty sure.
My mechs have mostly been bipeds, and until recently have been pretty stiff when walking if they even walk at all. I’m still far from good but as a new player I wanted to build mechs but had no clue how, so I feel this could be helpful to someone in my previous position. Although ideally a more talented mathematician or simple planes expert would have made this already. (I haven’t found any explanations, don’t sue me)

If I’ve explained anything poorly, please comment and I’ll try to explain.

I feel I owe this to the community after I started actually learning how to make a mech walk. Lots of thanks,

Axartar

  • Log in to leave a comment
  • Profile image

    My brain hurts

    4 months ago
  • Profile image
    19.0k Axartar

    @Nitrogeneating1160 oh I think I get what you mean, and thanks for the advice, bc I defo don’t have all the answers lol

    +1 7 months ago
  • Profile image

    So here it is if you still have provlems with the foot where its toes are the Throttle * sin(Time * 250)-0.15 can easily fix walking but if its still not fixed i dont have any answers but to change to Throttle * cos(Time * 240)-0.5 or -0.30

    7 months ago
  • Profile image
    19.0k Axartar

    @Nitrogeneating1160, I mean yeah? I reckon thatd work, I'm quite rusty with funky trees rn so explain it more and I'll see if I can help :)

    7 months ago
  • Profile image

    We could make the -1 onto 0 then do Throttle * sin(Time * 250)-0.15 on the feet

    7 months ago
  • Profile image
    19.0k Axartar

    @RodimusRhoamMaximus https://www.simpleplanes.com/a/90TqwQ/Transformers-scorponok
    ———————————
    This is my favourite example I think, what I’d recommend you to do is find a reference of a six legged creature or mech walking, and choosing a selection of keyframes over a single cycle of walking. With these you can find out how far each joint is extended and try to make sure the value is between -1 and 1 but if you want a more uncanny look you can exceed those boundaries.
    ———————————
    From there I like to put it into desmos the online graphing calculator, and I try and find a Sinusoidal graph that repeats every 2pi or 360 degrees. I choose the repetition over this duration because otherwise half of the walk is fine but after a cycle it won’t repeat. This graph is usually a massive amalgamation of lots of sines cosines etc in different amounts e.g. (sin2x+3cos4x)sinx.
    ———————————
    Now the last real thing I can say is to choose a simple multiple of 90 or 180 to multiply by time. The smaller the value the slower it walks, the larger the value the faster it walks.
    ———————————
    I hope this is helpful.

    +1 one year ago
  • Profile image
    19.0k Axartar

    @RodimusRhoamMaximus firstly wow that sounds incredible, I’m not really an expert and I have only worked on something up to quadrupedal, I’ll see if I can find you some good examples of 6 legged walkers

    one year ago
  • Profile image

    @Axartar what about 6 legs?(am building a Guardian Stalker)

    one year ago
  • Profile image
    19.0k Axartar

    @RodimusRhoamMaximus I’d have to check out the build, but seeing as it’s a transformer probably yes

    one year ago
  • Profile image

    @Axartar k, like E.G Jewolf's starscream build?

    one year ago
  • Profile image
    19.0k Axartar

    @RodimusRhoamMaximus should do, if you want it to transform with the same joints you might need to add some extra snippets of stuff.
    E.g. let’s say it’s legs are tucked away until group six is activated you could use,
    (walkingcode)*(Activate6)+(-1)(!Activate6)
    This assumes that -1 is a position where legs is tucked, and I could be wrong but I think in funky trees ! Means “not”. I hope this helps and I could explain more if needed

    +1 one year ago
  • Profile image

    thanks a lot, but question. does it work for vehicles that transform?

    one year ago
  • Profile image
    19.0k Axartar

    @MannedBeggur from there, try and keep the centre of mass near centre and try slowly reducing the stability, hopefully you’ll find a balance

    1.5 years ago
  • Profile image
    2,524 StinkyRice

    @Axartar i did it but its now shaking alot like its
    Having a seizure....

    1.5 years ago
  • Profile image
    2,524 StinkyRice

    @Axartar the graze is different but thanks

    1.5 years ago
  • Profile image
    19.0k Axartar

    @Blub00The00Builder the grammar is fine lol, and as for the gyros, try it with one gyroscope, have it on 2500% stability (25 in overload) and see if that stabilises it. From there it’s a fine balancing game. and that’s a hell of an impressive build, I’d love to see the complete version when done

    1.5 years ago
  • Profile image
    2,524 StinkyRice

    @Axartar the funky trees i used is Sin/Cos(Time * 180) and then added gyro scope but when i added one in the front it looks down like its deppressed also what im creating is the EB 06 Graze so go check it out on how the legs looks like

    this is the first time i typed this many so im really bad at grammar

    1.5 years ago
  • Profile image
    19.0k Axartar

    @Blub00The00Builder hmm, what funky stuff did you use as an input? Also, try putting all the code in brackets then multiplying by clamp01 of an activation group. E.G. (cos(Time✖️90))✖️clamp01(Activate1).
    I’m on mobile so I’m using the emoji multiplication sign instead of an asterisk. This will mean it can be turned on by pressing AG1

    1.5 years ago
  • Profile image
    2,524 StinkyRice

    i added one in the front but Its now looking Down but back then it was upwards and now it falls and goes up again in a circle

    1.5 years ago