Search found 74 matches

by c0der
Mon Feb 10, 2014 9:41 pm
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Rigid body box stacking
Replies: 32
Views: 55272

Re: Rigid body box stacking

Thanks Dirk. It starts off local, then I convert it to world coords per frame as you pointed out. My centroid is at the body's position anyway as it's a cube currently, will change the code later when I find the bug. It's really a minimal change in off-diagonal entries with my test case, as the box ...
by c0der
Mon Feb 10, 2014 9:16 am
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Rigid body box stacking
Replies: 32
Views: 55272

Re: Rigid body box stacking

Don't know if you're unlucky enough to come across this, but having an inertia tensor with diagonal entries 5.999995 as opposed to a plain 6, for a 1x1x1 cube of mass 1 causes instability for a single box on top of another with no friction. Manually setting it to 6 makes it stable, this is going to ...
by c0der
Mon Feb 10, 2014 4:25 am
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Rigid body box stacking
Replies: 32
Views: 55272

Re: Rigid body box stacking

Thanks Randy, will do that tonight. Here is the rest of the code void AMG3DQuaternion::addScaledVector(const AMG3DVector4& v, const AMG3DScalar& scale) { // To Do: Derive this AMG3DQuaternion q(0, v.x*scale, v.y*scale, v.z*scale); q *= *this; w += q.w * 0.5f; x += q.x * 0.5f; y += q.y * 0.5f...
by c0der
Sun Feb 09, 2014 8:18 am
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Rigid body box stacking
Replies: 32
Views: 55272

Re: Rigid body box stacking

I tried a simple case, box falling on another box of equal size and slightly off-center with each other, without friction. I also disabled the angular velocity update, so then the box is stable. Once I enable angular velocity update, the box keeps sliding and eventually falls off. I would expect tha...
by c0der
Mon Feb 03, 2014 1:46 am
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Rigid body box stacking
Replies: 32
Views: 55272

Re: Rigid body box stacking

Thanks a lot Randy, it still behaves the same way. Is this the approach you follow (see code)? I will attach the impulse code after as it's long. void AMG3DRigidBodyCollisionResponder::computeMasses(const AMG3DScalar& dt) { if(m_bSkipCollision) return; if(dt<=0.0f) return; const AMG3DScalar k_al...
by c0der
Sun Feb 02, 2014 9:52 am
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Rigid body box stacking
Replies: 32
Views: 55272

Re: Rigid body box stacking

Ran another test, I zero'd the velocities (6 box stack), then unzero'd them and they started up again. So I disabled the bias and the impulses converged at 10 iterations. Another test, disabled friction, stepped through, and the bias & penetration depths were uniform on all 4 contacts for the fi...
by c0der
Sun Feb 02, 2014 7:14 am
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Rigid body box stacking
Replies: 32
Views: 55272

Re: Rigid body box stacking

Thanks alot. I reverted back to what Dirk said, which is the correct way I had before. What's really weird is that when I have 10 iterations, a stack of 5 is almost instantly stable, but when I increase iterations to 15, energy gets introduced into the system. Something seriously wrong here. I don't...
by c0der
Sun Feb 02, 2014 4:24 am
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Rigid body box stacking
Replies: 32
Views: 55272

Re: Rigid body box stacking

Dirk, that's exactly what I did. The step where I discard contacts that are above the reference face causes a loss of contact point, which causes the instability. Randy, if I have those 3 cases, I am discarding points infront of the face plane (outside the OBB) technically, so the only valid case wi...
by c0der
Sat Feb 01, 2014 11:28 am
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Rigid body box stacking
Replies: 32
Views: 55272

Re: Rigid body box stacking

Ok I think I found the problem, it's the clipping algorithm epsilon. I use Sutherland-Hodgman and it returns 4 contacts, however when I clip them against the face plane, sometimes it retains 3 contacts, which is most likely what causes the box to wobble. The impulse solver is fine as it converges, t...
by c0der
Fri Jan 31, 2014 10:17 pm
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Rigid body box stacking
Replies: 32
Views: 55272

Re: Rigid body box stacking

Thanks Dirk, none of that seems to make a difference. I debugged it thoroughly with a simple case (box falling straight on a plane without friction) and found that the accumulated impulses from the four contact points come out as 1.108, 0.665, 1.108, 0.665 on the contacts diagonal to each other. Do ...
by c0der
Fri Jan 31, 2014 12:44 am
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Rigid body box stacking
Replies: 32
Views: 55272

Re: Rigid body box stacking

I combined the tangent vectors into 1 for both directions t1+t2. Now I am getting sliding problems, the overshoot is gone. I will deal with the arc later if it comes up, I am using an ortho basis computed from the normal for now
by c0der
Thu Jan 30, 2014 4:23 am
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Rigid body box stacking
Replies: 32
Views: 55272

Re: Rigid body box stacking

Actually now I realise why I didn't use the relative velocity, it's because I would then have to recompute the tangent masses as each iteration. I think the problem is in building the ortho basis at each frame for each contact, this means that for each contact, the tangent impulses won't be coplanar...
by c0der
Thu Jan 30, 2014 1:55 am
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Rigid body box stacking
Replies: 32
Views: 55272

Re: Rigid body box stacking

I actually mean by "variable timestep" the one I implemented from gafferongames. I am currently using a fixed timestep and still have the same problem. I disabled position correction and the jitter stopped, I am about to give up, been stuck for a while now. Also, I disabled friction.
by c0der
Wed Jan 29, 2014 9:47 pm
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Rigid body box stacking
Replies: 32
Views: 55272

Re: Rigid body box stacking

Thanks Dirk. I am using SAT and have some snapshots. I am trying 5 boxes now. I zero the collision velocities (EngineZeroCV.png) and the boxes are coming in fairly straight. When I enable impulses and disable position correction (EngineZero.png), I get an uneven effect, but this should be OK as the ...
by c0der
Tue Jan 28, 2014 10:16 pm
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Rigid body box stacking
Replies: 32
Views: 55272

Rigid body box stacking

Hi, I have got my clipping algorithm to work (I zero'd the collision velocities and drew the contact manifold to show this). Now I am having trouble with overshoot. I am using the interpenetration depth of each contact, which should technically be correct. I also have implemented warm starting I tri...