More question on Verlet

Started by
3 comments, last by cnboy0212 11 years, 8 months ago
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
Advertisement
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.
--bart
[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
--bart
Take a look at hardwire's post here: http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=4&t=1952&start=15&sid=ac8f739422f0fc789578f8c84a6e5cab

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.
thanks guys, haven't been on the forum for a while. I will take a look at the link

This topic is closed to new replies.

Advertisement