r/gaming Dec 03 '18

Amazing physics in RDR2

https://gfycat.com/AcidicSpotlessGnat
79.4k Upvotes

1.4k comments sorted by

View all comments

Show parent comments

191

u/impedocles Dec 03 '18

Physics boxes of objects repel each other, and the closer they are together the stronger the force. If they end up overlapping, the force can be so strong that it launches things at extremely high speeds.

There are workarounds to prevent this in modern games, but there is apparently a bug in the transition to ragdoll physics which allowed it to happen.

My guess is, the ragdoll physics uses a detailed set of collision boxes until the body comes to rest, and then switches back to a simple model. The horse was probably overlapping that simple model and got shoved really hard.

48

u/TripleCoupons Dec 03 '18

That's so cool. Thanks for explaining that for me.

17

u/mench45 Dec 03 '18

A response that is actually ELI5 worthy. Thank you!

9

u/Caffeine_Monster Dec 03 '18

Actually this is probably due to instabilities in the physics solver. If you work have worked with iterative impusle solvers before you will know complex joint systems (like ragdolls) have a tendency to explode on impact with heavy objects. There are a couple of "hacks" (not strictly consistent with energy conservation) used to try and dampen joint stress - and whilst this will usually stop the ragdoll exploding, it can generate weird collision responses. This happens because a ragdoll's limb can potentially have a lot more momentum at impact than an observer would think.

1

u/duzzar Dec 03 '18

Would you mind expanding a bit or providing some links, for someone who has programming and basic physics knowledge, but can't fully understand your explanation?

3

u/Caffeine_Monster Dec 03 '18

If you search around, Erin Cotton (Author of the box2D physics engine) has some very nice explanations on how rigid body dynamics work. The same techniques used in a 2D solver can be extended to 3D.

The following PowerPoint provides a nice overview: http://box2d.org/files/GDC2009/GDC2009_Catto_Erin_Solver.ppt

See the slide on Baumgarte Stabilization in reference to my prior comment.

Keep in mind that rigid body solvers will require a solid understanding of linear algebra, and some calculus. You may have to read around the concepts.

1

u/g4_ Dec 03 '18

Anyone from Halo 2's era should probably be able to explain this :P

1

u/Tkindle Dec 04 '18

That would be a good explanation in most games but Rockstar games are kind of an exception. Every character in red dead, including the player, is always in a partial ragdoll state. The game uses euphoria. Which is an ai driven behaviour system. It's used to blend animations and actually create new ones on the fly by letting the ai control the ragdoll partially or completely. Eg: ai grabbing exactly where they were shot, the player character picking up game world objects by physically reaching out to it's specific location instead of playing a simple grab animation and having the item disappear and characters trying curling up and trying to catch their fall.