Skip to main content
GameDev.net gamedev.net
🔒 Locked

Verlet Physics Question

Started by NickGravelyn Mar 19, 2007 at 8:38 PM 3 replies 1k views
Original Post
NickGravelyn
NickGravelyn
So after a suggestion on another thread, I've decided to try out Verlet physics vs my normal Euler integration physics. I got the basics working (falling particles with no collisions), but now I have run into a question. How do I handle collisions? I know that I can simply move the particle out to a point where it doesn't collide, but this just stops my particles from passing through other objects. Do I also have to apply a force?
NickGravelyn
NickGravelyn
I've tried a few different methods, but each one results in my particles rolling around on the terrain instead of bouncing. Is there something to the equation I missed?

public void Update(float dt){   Vector2 xt = x1;   x1 = (x1 - x0) * F / m * dt * dt;   x0 = xt;   F = Vector2.Zero;}
haphazardlynamed
haphazardlynamed
To bounce them, Reflect Both their Past and Future positions across the plane they collided with.
This Reflects their velocity -perfect bounce
since in Verlet the combo of positions Is their Velocity.
Petelnikov
Petelnikov
Verlet is only numeric integration method. You can use any collision response approach with it.
Many people using words "Verlet physics" for Thomas Jacobsen method.
Numsgil
Numsgil
The problem is Jacobsen's approach doesn't handle collisions in a way that ensures they obey the laws of conservation of momentum, for instance.

Check out this article on Wikipedia I wrote: Coefficient of Restitution. That should give you an idea of how you want to approach the problem.

The trick is realizing that you have to change the "oldpos" part of the verlet integrator in order to modify the velocity to a proper term. For this reason, and a few others, I generally prefer using velocity verlet myself.
[size=2]Darwinbots - [size=2]Artificial life simulation

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.