Move the circle

Above are two bodies, constrained together relative to their centers. After stumbling on a roughly 9 minutes video about procedural animations and simulating biological movement, I wondered if I could turn a couple sentences into actual working code. This being the first step of that process.
When two bodies are constrained at a distance an interesting behavior is observed where the larger body takes precedence as you would have also noticed, the bodies above bare a lot of resemblance to a planet and it's moon. Yet another point for Einstein's General Relativity

Move the highlighted circle

Although restraining two bodies at a distance relative to each other is quite cool. Even more fun than a simple distance constraint is a multiple distance constraint where each body is constrained to the one before and or after it, with each point of contact between the bodies acting as a sort of spine.
Using this simple concept we are able to simulate the movement of different animals, ranging from worms to reptiles.

Move the head

In order to properly simulate animal movement a few faults are to be considered, for example;
The body of our animal curving in on itself and bending past what we would consider natural .
With the introduction of a few rules like;
1> Preventing every Nth circle from colliding with circle Nth+2 and Nth-2
2> Enabling the "head" to collide with the rest of the body.
We achieve a more natural movement for our animal, concluding our biological simulation.






Inspiration Physics Engine Github Thank you for reading.