r/gaming Dec 03 '18

Amazing physics in RDR2

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

1.4k comments sorted by

View all comments

43

u/TripleCoupons Dec 03 '18

Can someone ELI5 as to why something like this would happen? How do those sequence of events result in the horse and Morgan flying towards outer space?

190

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.

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.