0 votes

So basically, I am trying to make a stick figure rig that is affected by physics that will be put in a ragdoll-esque state. (it's kind of like the stick figures from Off The Sticks by Dani, or one that you could put together in Algodoo)

I was able to rig my stick figure together with relative ease, however I'm unsure of how I can have Godot's 2D physics system handle it. I'm thinking I can parent this rig to a RigidBody2D, but then how can I add collision to it?
If I set up a CollisionPolygon2D I think it will just remain in the shape of the original pose and the shape won't be determined by the rig itself.
So how could I determine collision via my sprites/bones for a RigidBody2D? Or is there a better way altogether to make a ragdoll rig/rig affected by physics.

EDIT: After toying around with possible fixes a lot and finding nothing I'll try to be more specific with what I'm trying to achieve: The stick figure is rigged with the bones system so the limbs are connected. That's how far I've gotten. I can't figure out how to make the body parts stay connected, yet also be affected by physics and move on their own, here's the hierarchy of everything for the stick figure rig:

Torso, inside that there's the Head, Right Leg, Left Leg, Right Arm, Left Arm, which are all sprites. The arms and legs are split into an upper and lower section, and inside everything (excluding the torso itself and the upper body parts) there's a Position2D as an endpoint. I rigged it together using the tutorial from the Godot Docs.

I found that if I made a RigidBody + Collision for every part individually, the physics stuff would work. (although it is messy)
But with this rigging the character together just does not work, so all the body parts move on their own.
Then I tried storing all limbs as a RigidBody on the same layer and connecting them with PinJoint2Ds, still didn't work at all.

Godot version Godot Engine v.3.2.3.stable.official for 64-bit Windows
in Engine by (17 points)
edited by

1 Answer

0 votes
Best answer

https://www.youtube.com/watch?v=uGD_8mT_vi4

youtube is your best friend :)

by (1,371 points)
selected by

Unfortunately, nope, didn't really help. I edited the post giving some more detail.

Ah, actually, I got it working! The only problem is that for some reason the whole thing breaks if I try scaling the stick figure. Any idea how I can fix that?

what do you mean with breaks?

So, I scale the Node2D, and it looks like it was scaled, but when I run a test it doesn't scale at all and all the parts get squashed together, I'm guessing this is a problem with RigidBodies since it persists when I delete the Joints. I would send an image but my internet is being terrible right now.

some time ago i read that it was better to avoid scaling on the collision polygons, and rather actually draw smaller polygons.
dont know if this is still true, but maybe you are being bitten by this old "bug".

do you need to dynamically scale the rig during gameplay?

Well, I do use CollisionPolygons. But I can just change them to CollisionShapes if that'll fix it, since I'm only using circles and capsules. (I used Polygons instead since the capsule sprite I had and Godot's capsule weren't the same and I wanted absolute precision for collision)

What do you mean by "dynamically scale?" I don't plan on scaling the rig during gameplay anytime other than when it spawns so that it's small enough to fit the screen.

that was exactly what i meant: in that case it would be wiser to create all the objects (mesh, collision polygons, pin distance, etc) to have their final dimension already in the editor, and to keep the scale value =1

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.