Sign in to follow this  

More question on Verlet

This topic is 1944 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I try to implement verlet not too long ago, from "A Verlet based approach for 2D game physics" article in this site, Even though i got everything in that article, there are other problems that are bugging me. I tried to stack 2 boxes (4 vertices, 6 constraints) together(assuming gravity goes downward.) the 2 boxes will move away from each other horizontally slowly, and no friction is apply at this moment. Same thing when I try to stack many of them like a pyramid. the lower level of the pyramid will slowly move away from each other. The more levels i put on top, the fast they move away. I know probably caused by the update process of the constraints, since after collision detection and updating the constraints, the position and the orientation of the box will be slightly different from before. So my question is, how do you put a box(or any rigid body) to rest when they are suppose to be stationary? Thanks

Share this post


Link to post
Share on other sites
So you should have an edge/vertex point of contact. In the body containing the vertex, you should know that vertex velocity pretty easily.

In the body containing the edge, you'll have to calculate the exact point on the edge that is in contact, and then calculate the velocity of that point taking into account linear and rotational velocity components in this body.

Then you can calculate the relative collision velocity of the vertex and point on edge by simple subtraction.

Once you have the relative collision velocity, you can project it onto the normal vector of the edge, or the unit vector perpendicular to the edge. Note since this is a projection, you'll end up with a scalar or collision speed along the edge normal.

You'll apply the same force to both bodies but in opposite directions, and both forces will be parallel the edge involved in the collision.

Strictly speaking, this is dynamic friction. Static friction is basicly the same, but must have a magnitude sufficient enough to kill and relative motion between the vertex/edge projected onto the edge.

Hope that helped.

Share this post


Link to post
Share on other sites
[attachment=10606:VerletWellBin.zip]

This should help visualize the situation. Look at the vertexes of the boxes. Red light means dynamic, Green means static, and Blue means "dampening" (something I added). Hope that helps.

BTW, I'm told you can disassemble this code.. Good luck..

PS: when the system seattles down, you'll see the lights blinking rapidly. That is the shock wave traveling through the system.


--Bart

Share this post


Link to post
Share on other sites
Take a look at hardwire's post here:[url="http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=4&t=1952&start=15&sid=ac8f739422f0fc789578f8c84a6e5cab"] http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=4&t=1952&start=15&sid=ac8f739422f0fc789578f8c84a6e5cab[/url]

In his post he explicitly describes how to implement both static friction and dynamic friction. The dynamic friction method seems to solve the problem of bodies slowly separating away from each other while also adding some nice subtle effects. Edited by thecoast47

Share this post


Link to post
Share on other sites

This topic is 1944 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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