View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Verlet physics

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

3 replies to this topic

### #1MDSINA  Members

Posted 20 December 2012 - 09:24 AM

Hi guys!
http://www.gamedev.n...e-physics-r2714

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 -k*N+OldVelocity;
where N as I understood the normalized velocity (well, more multiplied by -1 is not?)

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

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]

### #2smallGame  Members

Posted 20 December 2012 - 12:39 PM

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...

### #3MDSINA  Members

Posted 21 December 2012 - 03:01 AM

Hi,
Here you can add the damping, but friction is related to the contact between two bodies.
V.Position += (V.Position-V.OldPosition) * damping + V.Acceleration*Timestep*Timestep;

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, 21 December 2012 - 03:02 AM.

### #4e‍dd  Members

Posted 21 December 2012 - 06:17 AM

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.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.