Legacy GM Ragdoll physics without physics engine

M

Matt93

Guest
I've been racking my brains trying to think how to implement a 2d ragdoll effect. I managed to make one using the physics engine, but would rather avoid using this. I'm making a game where you fling a player through a sling, Angry Birds style, and want to incorporate a ragdoll effect when he's thrown. Any ideas on how this would work? I'm also interested in how to make this work properly with gravity (so that each limb rotated correctly) and collisions. Is this possible?

Cheers.
 
E

ElBebo

Guest
Of course it is possible, but you would manually do everything the physics engine does. I think this would be a good challenge to a programmer but are you sure this would be worth? It's not my business why you chose not to use the default physics engine, anyway I'm trying to help you.

If I was you I would create an object for every single mobile piece of your ragdoll, endowed with local variable mass and linked to the other pieces updating the step event.
Objects would check forces by which they are affected every step and by the simple formula 'F = m * a' I would make it rotate the right way keeping in mind every factor concerning it.

Skills you must have to accomplish this exercise are a perfect knowledge of kinematics, simple machines and goniometry.
I ope I have helped you, I will keeping an eye to this topic because I'm interested.
 

GMWolf

aka fel666
This is pretty much like when someone tries to "fake 3d" and ends up either with parallax with sacaling, or a cpu raster: essentially redowing what d3d does much more efficiently.
As ElBebo said, the more accurate your want your ragdoll to be, the more features from a full physics engine you will need to impement.
 
M

Matt93

Guest
Of course it is possible, but you would manually do everything the physics engine does. I think this would be a good challenge to a programmer but are you sure this would be worth? It's not my business why you chose not to use the default physics engine, anyway I'm trying to help you.

If I was you I would create an object for every single mobile piece of your ragdoll, endowed with local variable mass and linked to the other pieces updating the step event.
Objects would check forces by which they are affected every step and by the simple formula 'F = m * a' I would make it rotate the right way keeping in mind every factor concerning it.

Skills you must have to accomplish this exercise are a perfect knowledge of kinematics, simple machines and goniometry.
I ope I have helped you, I will keeping an eye to this topic because I'm interested.
Thank you for replying. I'm trying to get to grips with physics at the moment, and thought this could be a useful exercise ;) Might be thoughtless of me, but hopefully good for my programming skills (and knowledge of physics) in the long run. Just a quick question - would rotation have to be done through image_angle, or is there a better way?
 
M

Matt93

Guest
This is pretty much like when someone tries to "fake 3d" and ends up either with parallax with sacaling, or a cpu raster: essentially redowing what d3d does much more efficiently.
As ElBebo said, the more accurate your want your ragdoll to be, the more features from a full physics engine you will need to impement.
Excellent. I feel that if I could learn to build a physics engine manually, it would set me up really well for future projects. It probably sounds ambitious. I'm just curious as to how the built-in physics engine translates into standard code. And this ragdoll problem has been on my mind for some time. I built one today in the physics engine but still didn't understand how it works! I felt like it offered me a lot of shortcuts - which I'm happy are there, but I'd rather be able to get to grips with how to build this from the ground up.
 

GMWolf

aka fel666
If you want to build one yourself, you must first familiarize yourself with rigid body mechanics (the mathematical part of it).
Then its just a matter of translating these equations into code. All the integration is done numerically which makes things easier (though less accurate :( )
The hardest part (i think) is getting the collisions to return the correct vectors to apply impulses, especially when rotation is involved.

An ambitious project it is! Good luck!
 
Top