Verlet collisions, no libraries | Sololearn: Learn to code for FREE!


Verlet collisions, no libraries

I am experimenting with Verlet rather than Euler integration in my mover codes. After reading some background it is not clear to me how to best handle collisions. Without velocity and thus easy conservation of moment, what are the best choices to make it look realistic? Anybody has examples or can point me to background reading? I am interested in knowing how it works, not in a blackbox library.

10/18/2020 1:43:13 PM


3 Answers

New Answer


The lazy approach I would use is to represent each stick as a "capsule". A capsule is a shape that has a lot of mathematical theories and stories behind them, with capsules, you don't need to do the complex axis rotation, line interception and geometry. You just assumed every points where the function f(y) = mx + c Is true, is a capsule segment with a fixed radius, each point in this function are a cirlces sharing the same mass, collision to be done for each point will be the same as circle-circle collision then conservation of momentum would be easy


thank you! I guess this is still compatible with rag doll animation, a few rigid bodies joined with springs? I was asking more about whether to use a spring-like force for collision or calculate velocity, in which case I am not sure I understabd why verlet code should be faster than Euler


I changed one of my codes from Euler to Verlet but I do not see skipping velocity brings any advantage, unless there is a clever way to shuffle pointers rather than copying previous positions. I would like to reduce the number of operations to afford more particles in e.g water animations.