0
\$\begingroup\$

I'm trying to make a 2D quadraped robot stand and walk via physics.

My robot looks like this. (art is not mine. Source is vapgames)

It's rigged via Unity's 2D animation package and each joint/bone has it's own collider + rigidbody with the legs also having hingejoints connecting the lower part to the upper part and the upper part to the main body of the robot. I've also set up IK for both legs using the 2D IK package with the IK target being attached to their respective leg via fixedjoint and can be moved programmatically to move the legs with respect to IK.

I want it to stand up, as at the moment is just falls and acts as a generic limp ragdoll. I've tried these methods:

  • Adding downward force to the legs via the IK targets

  • Adding upward force to the torso

  • Animating the IK targets to try and get the bot to stand up with animatePhysics enabled.

All of these failed (downard force to legs did pretty much nothing, upward force to torso just made it float if there was no ground, animating the IK targets was too glitchy).

I'm out of ideas on how to actually do this now. I've looked around for guides but there seems to be nothing good (I keep getting this suggested to me but it doesn't help. It's in 3D and the only thing that could help, spider legs, isn't finished and probably never will be)

There's very little information on how to do this sort of stuff and even when I find people who know about active ragdolls they just say add force to the head (for a 3D active ragdoll), which I've already tried (see 2. on the list of what I've already tried) and don't explain anyt further.

If anyone could help, that'd be great!

\$\endgroup\$
  • \$\begingroup\$ Scroll down in the article you linked that you say doesn't help you (or ctrl-f "Ragdoll Physics"). It talks very specifically about ragdolls. Ragdolls are a type of procedural animation. \$\endgroup\$ – Koala Squad Oct 3 at 17:00
  • \$\begingroup\$ I know. The article still doesn't help me. \$\endgroup\$ – Ducktor Oct 3 at 18:13
0
\$\begingroup\$

Generally rag doll only happens when you actually want the rag doll effect to occur. Most games use a completely separate system for movement. And only swap to rag doll when an explosion or large force is applied.

As for procedural movement you may want to look into springs, joints, and hinges.

\$\endgroup\$
  • \$\begingroup\$ As I've said, I've already got it set up as a ragdoll with the limbs attached to eachother via hinges. I want it to be ragdoll always, but have forces applied to stop it from just being limp all the time because I want it to be able to react to physical interactions in the environment. For example, if a person were to stand on it, it would get lower to the ground since it's legs can't really support the extra weight. \$\endgroup\$ – Ducktor Oct 4 at 12:02
0
\$\begingroup\$

So, I think I've got a solution that's sufficient for me.

My problem was that the legs wouldn't stay in the right position and trying stuff like AddForce and the other methods I said in the OP wouldn't work.

After a while of searching and asking questions someone asked if I had spring joints, which I didn't. After adding spring joints to my rig and setting it up, it seems I finally have the legs to stay in a desired position while not affecting anything else adversly (such as the effect of gravity with AddForce)

My current rig

My rig now looks like this. The green lines are the springs so you can see how they're connected and to which part.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.