Gravity jitter / how to make things slide

Started by
1 comment, last by ajas95 18 years, 9 months ago
I'm working on verlet integration for my 2D side-scrolling game, and I've got a couple of (possibly connected) issues I'm trying to resolve. The ground is defined by a set of polynomial curves, and I'm modelling a plane by its bounding box - its corners are the particles, and the four sides plus the two diagonals are its constraints. When the plane crashes, a couple of things go wrong. First of all, when it stops, it jitters. This is because the two particles that are not on the ground never lose their velocity - gravity keeps accelerating them, and since they don't hit the ground the engine allows them to move down and doesn't reduce their velocity. The stick constraints move them back into place, but they also move the bottom particles into the ground, which causes them to be projected back out. So, the plane jitters back and forth forever. I'd like for it to come to a stable stop. Anyone know a good way to model this? Second, from watching a couple of crash videos (I know, morbid...) and from an army friend, I know that planes tend to slide along the ground when they crash. I think that might be because they break up into pieces so the compression of the plane kills the velocity in the normal direction, but I was wondering if anyone knew the real reason why. I was also wondering if there's a good way to model objects sliding along the ground. I thought of this: once two points are on the ground and have very little speed in the normal direction, forget about the verlet simulation, figure out their speed in the tangential direction, and slide them along the curve at that speed using the derivative to accelerate/decelerate them (I already have it paramterized with respect to arc length). But if there's a good way to do it within verlet, that would be even better.
--------------Trans2D - 2D library for C# / Managed DirectX
Advertisement
I would think along the lines of momentum and friction. Sorry for the short reply, just browsing through. :)
You could keep track of which particles were involved in a collision and treat those as infinite mass (inv_mass = 0) with respect to constraint resolution. It feels kind of hacky, but it really does have some physical justification. It's like being pinned up against an immovable surface... the problem ultimately being that the 'pin' is directionless.

So that implies that an even better solution would be to keep track of the direction that the previous collision's resolution projected the point, and for the sake of constraint resolution, resolve the 2 particles s.t. the movement of the (previously collided) particle dots non-negative with its previous collision resolution. Do you know what I mean? I mean "make sure the constraints don't violate the movement that was just caused by collision resolution". Which is a cheap way of restating the problem... but I hope it's a little helpful.

This topic is closed to new replies.

Advertisement