Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Don't forget to read Tuesday's email newsletter for your chance to win a free copy of Construct 2!


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.

  • You cannot reply to this topic
3 replies to this topic

#1 MDSINA   Members   -  Reputation: 110

Like
0Likes
Like

Posted 20 December 2012 - 09:24 AM

Hi guys!
I was read this article on this site
http://www.gamedev.n...e-physics-r2714

And I wondered, what if upgrade it for experiment?
i downloaded it and decided to add friction.

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]

Sponsor:

#2 smallGame   Members   -  Reputation: 208

Like
0Likes
Like

Posted 20 December 2012 - 12:39 PM

Hi,
Here you can add the damping, but friction is related to the contact between two bodies.
So you could add :
[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...

#3 MDSINA   Members   -  Reputation: 110

Like
0Likes
Like

Posted 21 December 2012 - 03:01 AM

Hi,
Here you can add the damping, but friction is related to the contact between two bodies.
So you could add :
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.


#4 e‍dd   Members   -  Reputation: 2105

Like
1Likes
Like

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.



PARTNERS