Sign in to follow this  
NickGravelyn

Verlet Physics Question

Recommended Posts

NickGravelyn    855
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?

Share this post


Link to post
Share on other sites
NickGravelyn    855
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;
}

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Petelnikov    122
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.

Share this post


Link to post
Share on other sites
Numsgil    501
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this