Followers 0

# Verlet physics

## 3 posts in this topic

Hi guys!
[url="http://www.gamedev.net/page/resources/_/technical/math-and-physics/a-verlet-based-approach-for-2d-game-physics-r2714"]http://www.gamedev.n...e-physics-r2714[/url]

And I wondered, what if upgrade it for experiment?

But I did not understand how to do it correctly. We can replace the speed of this[b] [color=#ff0000]-k*N+OldVelocity[/color][/b][color=#ff0000];[/color]
[color=#000000]where N as I understood the normalized velocity (well, more multiplied by -1 is not?)[/color]

Well, add a small fix that would not work, that the infinite is force the body begins to move in the opposite direction
[b][color=#ff0000]VelNew = max(-k*N+OldVelocity, 0.0f)[/color][/b]

how to modify this method (if not this one?) to get the friction?
[source lang="cpp"]void Physics::UpdateVerlet() { //????????? ????????? ??????
for( int I = 0; I < VertexCount; I++ ) {
Vertex& V = *Vertices[ I ];

Vec2 OldPosition = V.Position;
V.Position += V.Position-V.OldPosition + V.Acceleration*Timestep*Timestep;
V.OldPosition = OldPosition;

}
}[/source]
0

##### Share on other sites
Hi,
Here you can add the damping, but friction is related to the contact between two bodies.
[source lang="java"]V.Position += (V.Position-V.OldPosition) * damping + V.Acceleration*Timestep*Timestep;[/source]

The friction will change the acceleration "V.Acceleration" in function of the contact normal.

Hope it can help...
0

##### Share on other sites
Hi,
Here you can add the damping, but friction is related to the contact between two bodies.
[source lang="java"]V.Position += (V.Position-V.OldPosition) * damping + V.Acceleration*Timestep*Timestep;[/source]

The friction will change the acceleration "V.Acceleration" in function of the contact normal.

Hope it can help...

Thanks, but it's not work true

Edited by MDSINA
0

##### Share on other sites
Once you have calculated the force due to friction, you divide by the mass to get the acceleration (a deceleration in this case) due to friction. This is then added to the acceleration before you perform an iteration of the verlet solver (or any other solver for the equations of motion). So your Physics::UpdateVerlet() method should not have to change. How you actually model friction is up to you. One simple model is to have the magnitude of friction be proportional to that of the perpendicular component of the contact force of the two bodies (so proportional to the weight -- the effect of mass due to gravity -- of a body if it is sitting on a flat surface). Any introductory book on Newtonian mechanics is likely to explain this model.
1

## Create an account

Register a new account