what is verlets?

Blitz3D Forums/Blitz3D Programming/what is verlets?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Imagine you have a single vertex which has simple physics applied to it. Wind, gravity, bounce, friction.

Now imagine you have a lot of these verlets. Eight of them. At the corners of a box.

Now imagine you have connected them with stiff rods. These rods can move in any direction but constrain each verlet to be a certain distance from the other verlet it's connected to.

To use verlets, you create the verlets, and then define which verlets are connected to one another, storing the distance apart which they should try to remain.

Then you do your basic physics on each verlet by itself, moving it however it WANTS to move, ignoring the connections to the other verlets, but colliding it with objects it wants to collide with.

Once you've done this, you do a "relaxation phase". You do several loops, each time looping through all the verlets and trying to move them towards the verlets they are connected to so that they are the right distance from their neighbors. So if verlet A is connected to verlet's B and C, you would move it in the direction of B so that it is the right distance from B, and then you would move it in the direction of C so it is the right distance from C. If you do this several times, then you will converge on a correct solution.

The side effect of all this is that MAGICALLY, your objects will rotate as they are supposed to when they hit something, and they will even bounce as a whole even though you're only simulating the bouncing of individual verlets.


There's one last thing you need to know about verlets and that is that instead of storing a direction and velocity for each, you store the velcoity in the positions of the verlets. But I forget how this works. Someone else will need to describe that. This special way of storing the velocity by storing two positions keeps the physics more stable.