Hello,
I'm pretty new to this forum (been reading a lot but not posting much) and I've been attempting to implement the rigid body ideas in the jakobsen verlet paper (embedding a particle constrained tetrahedron inside a rigid body).
I have 2d rigid bodies interacting with each other relatively realistically, but I can't get them to stop jittering while they are resting on the surface.
You can see an example here:
http://www.physicsdev.com/stam/physics/tetratests.swf
(press the mouse to create a box, needs flash player 9)
I read about John Schultz's method, which seems to work great for him, and was wondering if that could help me in this case as well...
What kind of tips can you give me (if any) to make resting contact with verlet smoother?
Thanks,
Oz
[solved] avoiding jitter with verlet rigid bodies
-
- Posts: 24
- Joined: Tue Aug 21, 2007 12:13 am
[solved] avoiding jitter with verlet rigid bodies
Last edited by oztune on Fri Aug 31, 2007 5:28 am, edited 1 time in total.
-
- Posts: 861
- Joined: Sun Jul 03, 2005 4:06 pm
- Location: Kirkland, WA
I shortly looked and I might give some tips though I am not sure whether they help with Verlet since I never implemented it for rigid bodies. First I would try not to correct the full penetration, but allow for some slop like Erin does in Box2D. Also you need to make sure to update or rebuild the contact points once you have solved a pair. Finally add friction and maybe some angular damping.
HTH,
-Dirk
HTH,
-Dirk
-
- Posts: 24
- Joined: Tue Aug 21, 2007 12:13 am
I've tried doing something like that which didn't work, but perhaps I didn't grasp the concept? If I allow penetration and then fix the intersection after a certain penetration threshold has been reached, the objects jump around more.Dirk Gregorius wrote:First I would try not to correct the full penetration, but allow for some slop like Erin does in Box2D.
Yep, I do thatAlso you need to make sure to update or rebuild the contact points once you have solved a pair.
I've found friction is a bit tricky with verlet. I'll give angular damping a try, but that should be tricky seeing as rotation is an implicit thing in this method and cannot be controlled directlyFinally add friction and maybe some angular damping.
-
- Posts: 26
- Joined: Sat Jun 30, 2007 4:34 am
What Dirk means by allow for some slop is that when you're fixing up the penetration, don't do a 100% projection; rather, figure out the correct place to project to, and project (say) 90% of the way there, or something like that.
But I've got to say, that "dancing" looks a little more severe than I've usually seen, though when I've used Verlet I haven't actually done the whole embedding thing, so I'm not sure how much that messes things up. I can tell you that using particles + stick constraints, I don't see dancing like that. Exactly how are you correcting those penetrations? My main problem with Verlet is not usually the dancing, it is the fact that general collisions resolved by pure projection don't have restitution without a bit of hacking around. It might help to hear the process that you go through to process the contact points - somehow pieces of your objects are getting upwards velocities from the floor, which is a bit odd because usually a pure projection just cancels out the vertical velocity rather than reversing it...
But I've got to say, that "dancing" looks a little more severe than I've usually seen, though when I've used Verlet I haven't actually done the whole embedding thing, so I'm not sure how much that messes things up. I can tell you that using particles + stick constraints, I don't see dancing like that. Exactly how are you correcting those penetrations? My main problem with Verlet is not usually the dancing, it is the fact that general collisions resolved by pure projection don't have restitution without a bit of hacking around. It might help to hear the process that you go through to process the contact points - somehow pieces of your objects are getting upwards velocities from the floor, which is a bit odd because usually a pure projection just cancels out the vertical velocity rather than reversing it...
-
- Posts: 24
- Joined: Tue Aug 21, 2007 12:13 am
Hey There,
Here's my resolution method:
(I describe the algo as collision with the ground or any other static object to make it cleaner, but as you can see it shakes in all the cases)
note: in the demo i linked to, if there are 2 contact points, i average their position and apply the push there.... but even without that code, the same jittering happens.
also, increasing the iterations doesn't seem to affect anything w/regards to jitter
In any case, thanks for taking a look at this and helping me out!
Oz
Here's my resolution method:
(I describe the algo as collision with the ground or any other static object to make it cleaner, but as you can see it shakes in all the cases)
Code: Select all
find collision contacts w/SAT
for each contact on dynamic object{
- transform contact pos to barycentric coords (with respect to the verlet triangle's 3 particles)
- use the code given in [jakobsen] to push the triangle (via the barycentric coords) with the push vector provided by the SAT algo.
- solve verlet triangle constraints (to restore its shape)
- update the polygon shape's pos/orientation according to the triangle's
}
also, increasing the iterations doesn't seem to affect anything w/regards to jitter
In any case, thanks for taking a look at this and helping me out!
Oz
-
- Posts: 24
- Joined: Tue Aug 21, 2007 12:13 am