Search found 74 matches

by c0der
Sat Feb 23, 2013 4:41 am
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Soft constraint derivation
Replies: 19
Views: 29287

Re: Soft constraint derivation

Thanks for the quick reply Dirk. I will try to make this as clear and detailed as possible for a simple distance joint For the distance joint constraint, I do this: P.zero(); // Zero the accumulated impulse PreStep() : C = |xa + ra - xb - rb| - InitialDistance A = n.dot(InvMa*n + SkewRaT*InvIa*n*Ske...
by c0der
Sat Feb 23, 2013 2:45 am
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Soft constraint derivation
Replies: 19
Views: 29287

Soft constraint derivation

So far, I have the following equations for the soft constraint general form JM^-1JT*lambda*dt = - Jv - beta/dt*C - gamma*lambda Lambda is currently a force To turn lambda into an impulse, i multiply by dt (JM^-1JT*dt + gamma)*lambda' = -Jv*dt - beta*C beta = ERP = (k*dt)/(c+k*dt) gamma = CFM = 1/(c ...
by c0der
Fri Feb 22, 2013 10:48 am
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Sequential impulses and warm starting
Replies: 15
Views: 22237

Re: Sequential impulses and warm starting

For anyone who is interested, just as I was about to give up, I thought of something that fixed the problem to an extent: 1) Increase the thickness of the clipping planes by increasing the plane epsilon to 10^-2 (after experimenting with various epsilon values). 2) DO not clip against the face plane...
by c0der
Fri Feb 22, 2013 4:03 am
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Sequential impulses and warm starting
Replies: 15
Views: 22237

Re: Sequential impulses and warm starting

Tuning the bias factor didn't do anything. m_cdContactData.contacts[i].bias = k_biasFactor / dt * AMG3D_MATH_MAX(0.0f, m_cdContactData.contacts[i].sPenetrationDepth - k_allowedPenetration); I calculate the bias above where the penetration depth is +ve and the allowed penetration is 0.01, with a bias...
by c0der
Fri Feb 22, 2013 12:26 am
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Sequential impulses and warm starting
Replies: 15
Views: 22237

Re: Sequential impulses and warm starting

Ok, let's forget about the relative velocity for a minute and use two tangent directions by btPlaneSpace. Now I only have to compute the masses seen by the impulse only once per frame since they no longer depend on the tangent vectors which depend on relative velocity. My stack is stable now with wa...
by c0der
Thu Feb 21, 2013 11:35 pm
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Sequential impulses and warm starting
Replies: 15
Views: 22237

Re: Sequential impulses and warm starting

What about the normal and tangent masses? Are these pre-computed once per frame before the impulse iterations, or for the tangent impulses, they need to be computed at each iteration since the relative velocity changes?
by c0der
Thu Feb 21, 2013 10:12 am
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Sequential impulses and warm starting
Replies: 15
Views: 22237

Re: Sequential impulses and warm starting

I couldn't paste my applyImpulse code for some reason. I assume you calculate friction at each iteration rather than once per frame as it depends on relative velocity
by c0der
Thu Feb 21, 2013 10:08 am
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Sequential impulses and warm starting
Replies: 15
Views: 22237

Sequential impulses and warm starting

I have identified a problem related to friction in my impulse solver and don't know what's causing the problem. I disabled friction, enabled warm starting, accumulating impulses and position correction and things work fine. Can someone tell me what the problem is? Implementing friction in 3D is tric...
by c0der
Thu Feb 21, 2013 4:54 am
Forum: General Bullet Physics Support and Feedback
Topic: How to convert from world coordinate
Replies: 6
Views: 12538

Re: How to convert from world coordinate

For my hinge joint, I have one anchor given in world coords and a world hinge axis. From the world anchor, you build two local anchors as follows for each body wt1T.transposeOf(m_pRigidBody1->m_matWorldTransform); wt2T.transposeOf(m_pRigidBody2->m_matWorldTransform); m_vLocalAnchor1 = (vAnchor - m_p...
by c0der
Thu Feb 21, 2013 1:39 am
Forum: General Bullet Physics Support and Feedback
Topic: How to convert from world coordinate
Replies: 6
Views: 12538

Re: How to convert from world coordinate

Converting from world to local just involves multiplying the world transform matrix of the object by the inverse to get the identity matrix. Normally you want to transform a different object B into the local frame of object A, which just involves multiplying B's world transform matrix by A's inverse...
by c0der
Thu Feb 14, 2013 6:22 am
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Collision with a quad terrain
Replies: 6
Views: 11176

Re: Collision with a quad terrain

Found a problem with this approach, for anyone who may run into this problem... Testing against 6 triangles generates more contacts than necessary, leading to jittery physics. An example is two contacts on neighbouring triangles are too close and cause double the impulse in close proximity. I have n...
by c0der
Fri Feb 08, 2013 2:54 am
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Quaternion angle constraint
Replies: 0
Views: 4468

Quaternion angle constraint

Hi, I am representing the orientation of a rigid body as a quaternion and the angular velocity as a vector. I am attempting to implement an angle constraint directly from the quaternion without having to store a vector alongside the quaternion in the rigid body class to represent the orientation. C ...
by c0der
Wed Feb 06, 2013 11:12 pm
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Revolute joint between two particles
Replies: 0
Views: 4084

Revolute joint between two particles

Hi, I am having trouble with implementing a revolute joint between two particles. I am representing the particle as having a position, velocity and acceleration and no angular dynamic components. So the constraint derivation is as follows: C = xa + ra - xb - rb CDot = va - vb CDot = [ 1 -1] [va vb]T...
by c0der
Sat Jan 26, 2013 1:28 pm
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Collision with a quad terrain
Replies: 6
Views: 11176

Re: Collision with a quad terrain

That's true! It is interesting how large games such as GTA handle a large amount of collisions in a huge world. Perhaps things like using really simple primitives like bounding spheres to keep objects from overlapping each other when they're out of view or too far from the camera for the detail to b...
by c0der
Fri Jan 25, 2013 9:46 am
Forum: Research and development discussion about Collision Detection and Physics Simulation
Topic: Collision with a quad terrain
Replies: 6
Views: 11176

Re: Collision with a quad terrain

Solved, used a grid to partition the terrain and simple AABB tests to narrow the collision down to 6 triangles and finally applied SAT to generate contacts between the terrain triangles and OBB.

Very fast for anyone who is trying to find a way to do OBB-terrain collisions with physics response