Jump to content

  • Log In with Google      Sign In   
  • Create Account


More question on Verlet


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
4 replies to this topic

#1 cnboy0212   Members   -  Reputation: 166

Like
0Likes
Like

Posted 02 August 2012 - 04:35 AM

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

Sponsor:

#2 bpj1138   Members   -  Reputation: 113

Like
0Likes
Like

Posted 07 August 2012 - 04:00 PM

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

#3 bpj1138   Members   -  Reputation: 113

Like
0Likes
Like

Posted 10 August 2012 - 06:05 PM

Attached File  VerletWellBin.zip   8.53KB   36 downloads

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

#4 thecoast47   Members   -  Reputation: 255

Like
0Likes
Like

Posted 12 August 2012 - 03:07 PM

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.

Edited by thecoast47, 12 August 2012 - 09:02 PM.


#5 cnboy0212   Members   -  Reputation: 166

Like
0Likes
Like

Posted 17 August 2012 - 04:59 PM

thanks guys, haven't been on the forum for a while. I will take a look at the link




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