29 #include "../../idlib/precompiled.h"
32 #include "../Game_local.h"
55 LCP_EPSILON, LCP_EPSILON, LCP_EPSILON );
60 static int lastTimerReset = 0;
61 static int numArticulatedFigures = 0;
62 static idTimer timer_total, timer_pc, timer_ac, timer_collision, timer_lcp;
102 memset( &
fl, 0,
sizeof(
fl ) );
119 if (
body1 != body) {
133 if (
body2 != body ) {
176 if ( body ==
body1 ) {
179 else if ( body ==
body2 ) {
185 force[0] = v[0]; force[1] = v[1]; force[2] = v[2]; force[3] = v[3]; force[4] = v[4]; force[5] = v[5];
304 if (
body1 != body) {
319 if (
body2 != body ) {
572 const float angle1,
const float angle2,
const idVec3 &body1Axis ) {
665 float invMass, currentFriction;
669 if ( currentFriction <= 0.0f ) {
682 angular *= currentFriction / invMass;
823 name =
"ballAndSocketJointFriction";
878 J1[0][3] =
J1[1][4] =
J1[2][5] = 1.0f;
883 J2[0][3] =
J2[1][4] =
J2[2][5] = 1.0f;
1074 const float angle1,
const float angle2 ) {
1126 idVec3 a1, a2, s1, s2, d1, d2,
v;
1151 0.0f, 0.0f, 0.0f ) );
1158 0.0f, 0.0f, 0.0f ) );
1171 m1[2] = v.
Cross( m1[0] );
1175 m2[2] = v.
Cross( m2[0] );
1199 float invMass, currentFriction;
1203 if ( currentFriction <= 0.0f ) {
1216 angular *= currentFriction / invMass;
1294 idVec3 a1, a2, s1, s2, d1, d2,
v;
1320 m1[2] = v.
Cross( m1[0] );
1324 m2[2] = v.
Cross( m2[0] );
1402 name =
"universalJointFriction";
1444 idVec3 s1, s2, dir1, dir2;
1575 this->body1 =
body1;
1576 this->body2 =
body2;
1805 vecY[0], vecY[1], vecY[2],
1806 0.0f, 0.0f, 0.0f ) );
1812 -vecY[0], -vecY[1], -vecY[2],
1813 0.0f, 0.0f, 0.0f ) );
1820 cross = x1.
Cross( x2 );
1842 float invMass, currentFriction;
1846 if ( currentFriction <= 0.0f ) {
1859 angular *= currentFriction / invMass;
2034 name =
"hingeFriction";
2140 name =
"hingeFriction";
2277 this->body1 =
body1;
2278 this->body2 =
body2;
2525 this->body1 =
body1;
2526 this->body2 =
body2;
2690 this->body1 =
body1;
2691 this->body2 =
body2;
2721 assert( stretch >= 0.0f && compress >= 0.0f && restLength >= 0.0f );
2734 assert( minLength >= 0.0f && maxLength >= 0.0f && maxLength >= minLength );
2745 idVec3 a1, a2, velocity1, velocity2, force;
2747 float d, dampingForce,
length, error;
2771 dampingForce = 0.0f;
2773 length = force.Normalize();
2780 master->
AddForce( a2, -springForce );
2789 master->
AddForce( a2, -springForce );
2879 center = ( a1 + a2 ) * 0.5f;
2901 mid = a1 + 0.5f * dir;
3004 float minBounceVelocity = 2.0f;
3056 idVec3 r, velocity, normal, dir1, dir2;
3057 float friction, magnitude, forceNumerator, forceDenominator;
3067 if ( friction <= 0.0f ) {
3086 forceNumerator = friction * magnitude;
3088 impulse.
SubVec3(0) = (forceNumerator / forceDenominator) * normal;
3161 name =
"contactFriction";
3252 c1[0] =
c1[1] = 0.0f;
3263 c2[0] =
c2[1] = 0.0f;
3423 idVec3 ax, anchor, body1ax, normal, coneVector, p1, p2;
3456 normal = body1ax.
Cross( ax );
3462 coneVector = ax * q.
ToMat3();
3463 normal = coneVector.
Cross( ax ).
Cross( coneVector );
3523 float sinAngle,
a,
size = 10.0f;
3543 x *= size * sinAngle;
3544 y *= size * sinAngle;
3547 for ( a = 0.0f; a < 360.0f; a += 45.0f ) {
3601 name =
"pyramidLimit";
3614 const float pyramidAngle1,
const float pyramidAngle2,
const idVec3 &body1Axis ) {
3622 pyramidBasis[0].Normalize();
3623 pyramidBasis[1] = pyramidBasis[0].Cross( pyramidBasis[2] );
3682 idVec3 anchor, body1ax, ax[2],
v, normal, pyramidVector, p1, p2;
3707 for ( i = 0; i < 2; i++ ) {
3708 ax[
i] = body1ax - worldBase[!
i] * body1ax * worldBase[!
i];
3710 a[
i] = worldBase[2] * ax[
i];
3720 pyramidVector = worldBase[2];
3721 for ( i = 0; i < 2; i++ ) {
3723 v = ax[
i].
Cross( worldBase[2] );
3729 pyramidVector *= q.
ToMat3();
3732 normal = pyramidVector.
Cross( worldBase[2] ).
Cross( pyramidVector );
3817 for ( i = 0; i < 2; i++ ) {
3825 dir = worldBase[2] *
size;
3826 p[0] = anchor + m[0] * (m[1] * dir);
3827 p[1] = anchor + m[0] * (m[1].
Transpose() * dir);
3829 p[3] = anchor + m[0].
Transpose() * (m[1] * dir);
3831 for ( i = 0; i < 4; i++ ) {
3889 name =
"suspension";
3952 float velocity, suspensionLength, springLength, compression, dampingForce, springForce;
3953 idVec3 origin,
start,
end, vel1, vel2, springDir,
r, frictionDir, motorDir;
3962 rotation.
SetVec( axis[2] );
3965 axis *= rotation.
ToMat3();
3991 compression = suspensionLength - springLength;
4012 c1[0] = -compression;
4016 hi[0] = springForce;
4021 frictionDir = axis[1] - axis[1] *
trace.
c.
normal * axis[1];
4047 motorDir = axis[0] - axis[0] *
trace.
c.
normal * axis[0];
4111 rotation.
SetVec( axis[2] );
4114 axis *= rotation.
ToMat3();
4154 this->clipModel =
NULL;
4225 memset( &
fl, 0,
sizeof(
fl ) );
4237 if ( this->clipModel && this->clipModel != clipModel ) {
4249 if ( linear < 0.0f || linear > 1.0f ||
4250 angular < 0.0f || angular > 1.0f ||
4252 gameLocal.
Warning(
"idAFBody::SetFriction: friction out of range, linear = %.1f, angular = %.1f, contact = %.1f", linear, angular, contact );
4266 if ( bounce < 0.0f || bounce > 1.0f ) {
4267 gameLocal.
Warning(
"idAFBody::SetBouncyness: bouncyness out of range, bounce = %.1f", bounce );
4293 gameLocal.
Warning(
"idAFBody::SetDentity: center of mass not at origin for body '%s'",
name.c_str() );
4391 const float *vPtr =
v;
4395 dstPtr[0] = mPtr[0*6+0] * vPtr[0];
4396 dstPtr[1] = mPtr[1*6+1] * vPtr[1];
4397 dstPtr[2] = mPtr[2*6+2] * vPtr[2];
4398 dstPtr[3] = mPtr[3*6+3] * vPtr[3] + mPtr[3*6+4] * vPtr[4] + mPtr[3*6+5] * vPtr[5];
4399 dstPtr[4] = mPtr[4*6+3] * vPtr[3] + mPtr[4*6+4] * vPtr[4] + mPtr[4*6+5] * vPtr[5];
4400 dstPtr[5] = mPtr[5*6+3] * vPtr[3] + mPtr[5*6+4] * vPtr[4] + mPtr[5*6+5] * vPtr[5];
4497 child = body->
children[
j]->primaryConstraint;
4504 child->
invI = childI;
4506 gameLocal.
Warning(
"idAFTree::Factor: couldn't invert %dx%d matrix for constraint '%s'",
4509 child->
J = child->
invI * child->
J;
4514 body->
invI = body->
I;
4516 gameLocal.
Warning(
"idAFTree::Factor: couldn't invert %dx%d matrix for body %s",
4520 body->
J = body->
invI * body->
J;
4551 primaryConstraint->
fl.
isZero =
false;
4553 if ( !primaryConstraint->
fl.
isZero ) {
4567 if ( primaryConstraint ) {
4573 if ( !primaryConstraint->
fl.
isZero ) {
4574 primaryConstraint->
s = primaryConstraint->
invI * primaryConstraint->
s;
4578 primaryConstraint->
lm = primaryConstraint->
s;
4586 body->
s = body->
invI * body->
s;
4591 body->
s = body->
invI * body->
s;
4611 body = constraint->
body1;
4612 if ( body->
tree ==
this ) {
4617 body = constraint->
body2;
4630 if ( primaryConstraint ) {
4631 primaryConstraint->
s.
Zero();
4632 primaryConstraint->
fl.
isZero =
true;
4640 body = constraint->
body1;
4641 if ( body->
tree ==
this ) {
4644 if ( primaryConstraint ) {
4645 primaryConstraint->
J1.
Multiply( primaryConstraint->
s, v );
4646 primaryConstraint->
fl.
isZero =
false;
4649 child = body->
children[
i]->primaryConstraint;
4657 body = constraint->
body2;
4658 if ( body && body->
tree ==
this ) {
4661 if ( primaryConstraint ) {
4663 primaryConstraint->
fl.
isZero =
false;
4666 child = body->
children[
i]->primaryConstraint;
4675 Solve( auxiliaryIndex );
4692 if ( primaryConstraint ) {
4696 child = body->
children[
j]->primaryConstraint;
4729 invStep = 1.0f / timeStep;
4738 if ( primaryConstraint ) {
4740 c = primaryConstraint;
4757 if ( primaryConstraint ) {
4761 child = body->
children[
j]->primaryConstraint;
4867 invTimeStep = 1.0f / timeStep;
5001 invTimeStep = 1.0f / timeStep;
5022 for ( i = 0; i <
trees.
Num(); i++ ) {
5035 for ( i = 0; i <
trees.
Num(); i++ ) {
5036 trees[
i]->CalculateForces( timeStep );
5046 int i,
j, k,
l,
n, m,
s, numAuxConstraints, *
index, *boxIndex;
5047 float *ptr, *
j1, *
j2, *dstPtr, *forcePtr;
5060 if ( numAuxConstraints == 0 ) {
5065 forcePtr = (
float *) _alloca16(
bodies.
Num() * numAuxConstraints * 8 *
sizeof(
float ) );
5066 index = (
int *) _alloca16(
bodies.
Num() * numAuxConstraints *
sizeof(
int ) );
5073 forcePtr += numAuxConstraints * 8;
5074 index += numAuxConstraints;
5081 for ( j = 0; j < constraint->
J1.
GetNumRows(); j++, k++ ) {
5090 for ( i = 0; i <
trees.
Num(); i++ ) {
5091 trees[
i]->SetMaxSubTreeAuxiliaryIndex();
5099 for ( j = 0; j < constraint->
J1.
GetNumRows(); j++, k++ ) {
5112 jmk.
SetData( numAuxConstraints, ((numAuxConstraints+3)&~3),
MATX_ALLOCA( numAuxConstraints * ((numAuxConstraints+3)&~3) ) );
5119 for ( j = 0; j < constraint->
J1.
GetNumRows(); j++, k++ ) {
5126 for ( l = n = 0, m = index[n]; n < constraint->
body1->
numResponses && m <
s; n++, m = index[
n] ) {
5130 dstPtr[l++] = j1[0] * ptr[0] + j1[1] * ptr[1] + j1[2] * ptr[2] +
5131 j1[3] * ptr[3] + j1[4] * ptr[4] + j1[5] * ptr[5];
5139 if ( constraint->
body2 ) {
5144 for ( n = 0, m = index[n]; n < constraint->
body2->
numResponses && m <
s; n++, m = index[
n] ) {
5145 dstPtr[m] += j2[0] * ptr[0] + j2[1] * ptr[1] + j2[2] * ptr[2] +
5146 j2[3] * ptr[3] + j2[4] * ptr[4] + j2[5] * ptr[5];
5155 for ( i = 0; i < numAuxConstraints; i++ ) {
5158 for ( j = i+1; j < numAuxConstraints; j++ ) {
5165 invStep = 1.0f / timeStep;
5178 boxIndex = (
int *) _alloca16( numAuxConstraints *
sizeof(
int ) );
5191 for ( j = 0; j < constraint->
J1.
GetNumRows(); j++, k++ ) {
5193 j1 = constraint->
J1[
j];
5195 rhs[k] = j1[0] * ptr[0] + j1[1] * ptr[1] + j1[2] * ptr[2] + j1[3] * ptr[3] + j1[4] * ptr[4] + j1[5] * ptr[5];
5196 rhs[k] += constraint->
c1[
j] * invStep;
5198 if ( constraint->
body2 ) {
5199 j2 = constraint->
J2[
j];
5201 rhs[k] += j2[0] * ptr[0] + j2[1] * ptr[1] + j2[2] * ptr[2] + j2[3] * ptr[3] + j2[4] * ptr[4] + j2[5] * ptr[5];
5202 rhs[k] += constraint->
c2[
j] * invStep;
5206 lo[k] = constraint->
lo[
j];
5207 hi[k] = constraint->
hi[
j];
5209 if ( constraint->
boxIndex[j] >= 0 ) {
5211 gameLocal.
Error(
"cannot reference primary constraints for the box index" );
5218 jmk[k][k] += constraint->
e[
j] * invStep;
5227 if ( !
lcp->
Solve( jmk, lm, rhs, lo, hi, boxIndex ) ) {
5239 for ( j = 0; j < constraint->
J1.
GetNumRows(); j++, k++ ) {
5240 constraint->
lm[
j] = u = lm[k];
5242 j1 = constraint->
J1[
j];
5244 ptr[0] += j1[0] * u; ptr[1] += j1[1] * u; ptr[2] += j1[2] * u;
5245 ptr[3] += j1[3] * u; ptr[4] += j1[4] * u; ptr[5] += j1[5] * u;
5247 if ( constraint->
body2 ) {
5248 j2 = constraint->
J2[
j];
5250 ptr[0] += j2[0] * u; ptr[1] += j2[1] * u; ptr[2] += j2[2] * u;
5251 ptr[3] += j2[3] * u; ptr[4] += j2[4] * u; ptr[5] += j2[5] * u;
5275 float impulseNumerator, impulseDenominator;
5276 idVec3 r, velocity, normalVelocity, normal, impulse;
5289 normalVelocity = ( velocity * contact.
normal ) * contact.
normal;
5292 if ( normalVelocity * contact.
normal < 0.0f ) {
5294 normal = -normalVelocity;
5297 impulse = (impulseNumerator / impulseDenominator) * normal * 1.0001f;
5339 float vSqr, maxLinearVelocity, maxAngularVelocity;
5351 if ( maxLinearVelocity > 0.0f ) {
5354 if ( vSqr >
Square( maxLinearVelocity ) ) {
5359 if ( maxAngularVelocity > 0.0f ) {
5362 if ( vSqr >
Square( maxAngularVelocity ) ) {
5382 rotation.Normalize180();
5405 idMat3 inverseWorldInertiaTensor;
5406 float impulseNumerator, impulseDenominator;
5411 if ( ent ==
self ) {
5424 if ( velocity * collision.
c.
normal > 0.0f ) {
5425 velocity = collision.
c.
normal;
5428 impulseNumerator = -( 1.0f + body->
bouncyness ) * ( velocity * collision.
c.
normal );
5429 impulseDenominator = body->
invMass + ( ( inverseWorldInertiaTensor * r.
Cross( collision.
c.
normal ) ).Cross( r ) * collision.
c.
normal );
5433 impulse = (impulseNumerator / impulseDenominator) * collision.
c.
normal;
5439 return self->Collide( collision, velocity );
5474 bodies[
i]->clipModel->Disable();
5493 if (
bodies[i]->fl.selfCollision ) {
5494 bodies[
i]->clipModel->Enable();
5496 bodies[
i]->clipModel->Disable();
5515 }
else if ( body->
constraints[i]->body2 == body ) {
5561 #ifdef TEST_COLLISION_DETECTION
5562 bool startsolid =
false;
5588 #ifdef TEST_COLLISION_DETECTION
5591 if ( !startsolid ) {
5608 int i,
j, k, numContacts, numBodyContacts;
5647 for ( j = 0; j < numContacts; j++ ) {
5649 numBodyContacts = 0;
5651 if (
contacts[k].entityNum == contactInfo[j].entityNum ) {
5655 if ( (
contacts[k].point - contactInfo[j].point ).LengthSqr() <
Square( 2.0f ) ) {
5665 if ( k >=
contacts.
Num() && numBodyContacts < 3 ) {
5673 for ( j = 0; j < numContacts; j++ ) {
5909 float translationSqr, maxTranslationSqr, rotation, maxRotation;
5939 maxTranslationSqr = 0.0f;
5945 if ( translationSqr > maxTranslationSqr ) {
5946 maxTranslationSqr = translationSqr;
5949 if ( rotation > maxRotation ) {
5950 maxRotation = rotation;
5995 bodies[
i]->current->spatialVelocity.Zero();
5996 bodies[
i]->current->externalForce.Zero();
6060 bodies[
i]->current->spatialVelocity += pushVelocity;
6129 bodies[
id]->GetClipModel()->SetContents( contents );
6133 bodies[
i]->GetClipModel()->SetContents( contents );
6147 return bodies[
id]->GetClipModel()->GetContents();
6152 contents |=
bodies[
i]->GetClipModel()->GetContents();
6168 return bodies[
id]->GetClipModel()->GetBounds();
6175 relBounds =
bodies[0]->GetClipModel()->GetBounds();
6181 relBounds += bounds;
6197 return bodies[
id]->GetClipModel()->GetAbsBounds();
6204 absBounds =
bodies[0]->GetClipModel()->GetAbsBounds();
6206 absBounds +=
bodies[
i]->GetClipModel()->GetAbsBounds();
6241 self->GetMasterPosition( masterOrigin, masterAxis );
6259 timer_total.
Start();
6263 timer_collision.
Start();
6273 timer_collision.
Stop();
6286 int i, numPrimary = 0, numAuxiliary = 0;
6330 timer_collision.
Start();
6337 timer_collision.
Stop();
6369 gameLocal.
Warning(
"articulated figure moved outside world bounds for entity '%s' type '%s' at (%s)",
6370 self->
name.
c_str(),
self->GetType()->classname,
bodies[0]->current->worldOrigin.ToString(0) );
6378 gameLocal.
Printf(
"%12s: t %1.4f pc %2d, %1.4f ac %2d %1.4f lcp %1.4f cd %1.4f\n",
6386 numArticulatedFigures++;
6387 if ( endTimeMSec > lastTimerReset ) {
6388 gameLocal.
Printf(
"af %d: t %1.4f pc %2d, %1.4f ac %2d %1.4f lcp %1.4f cd %1.4f\n",
6389 numArticulatedFigures,
6397 if ( endTimeMSec > lastTimerReset ) {
6398 lastTimerReset = endTimeMSec;
6399 numArticulatedFigures = 0;
6400 timer_total.
Clear();
6403 timer_collision.
Clear();
6442 for ( i = 0; i < numSilEdges; i++ ) {
6470 constrainedBody1 = constraint->
body1;
6471 if ( constrainedBody1 ) {
6473 constrainedBody1->clipModel->GetAxis(),
vec3_origin, 0.0f );
6476 constrainedBody2 = constraint->
body2;
6477 if ( constrainedBody2 ) {
6479 constrainedBody2->clipModel->GetAxis(),
vec3_origin, 0.0f );
6488 if ( highlightBody ) {
6499 if ( body == constrainedBody1 || body == constrainedBody2 ) {
6502 if ( body == highlightBody ) {
6535 I[0].
x, I[0].
y, I[0].
z,
6536 I[1].x, I[1].y, I[1].z,
6537 I[2].x, I[2].y, I[2].z ),
6577 for ( i = 0; i <
trees.
Num(); i++ ) {
6797 bodies[
i]->Restore( saveFile );
6870 return ( b1 == b2 );
6939 if ( !
bodies[i]->parent ) {
6950 if (
bodies[i]->parent ) {
6959 gameLocal.
Warning(
"Articulated figure has multiple seperate tree structures for entity '%s' type '%s'.",
6964 for ( i = 0; i <
trees.
Num(); i++ ) {
7048 gameLocal.
Error(
"idPhysics_AF::AddConstraint: a constraint with the name '%s' already exists.", constraint->
name.
c_str() );
7050 if ( !constraint->
body1 ) {
7051 gameLocal.
Error(
"idPhysics_AF::AddConstraint: body1 == NULL on constraint '%s'.", constraint->
name.
c_str() );
7054 gameLocal.
Error(
"idPhysics_AF::AddConstraint: body1 of constraint '%s' is not part of the articulated figure.", constraint->
name.
c_str() );
7057 gameLocal.
Error(
"idPhysics_AF::AddConstraint: body2 of constraint '%s' is not part of the articulated figure.", constraint->
name.
c_str() );
7059 if ( constraint->
body1 == constraint->
body2 ) {
7060 gameLocal.
Error(
"idPhysics_AF::AddConstraint: body1 and body2 of constraint '%s' are the same.", constraint->
name.
c_str() );
7091 if (
id != newId ) {
7108 if (
id == -1 && body ) {
7127 gameLocal.
Error(
"GetBodyId: no body with the name '%s' is not part of the articulated figure.\n", bodyName );
7140 if (
id == -1 && constraint ) {
7141 gameLocal.
Error(
"GetConstraintId: constraint '%s' is not part of the articulated figure.\n", constraint->
name.
c_str() );
7159 gameLocal.
Error(
"GetConstraintId: no constraint with the name '%s' is not part of the articulated figure.\n", constraintName );
7235 gameLocal.
Error(
"GetConstraint: no constraint with id %d exists\n",
id );
7257 gameLocal.
Warning(
"DeleteBody: no body found in the articulated figure with the name '%s' for entity '%s' type '%s'.",
7293 bodies[
j]->clipModel->SetId( j );
7315 gameLocal.
Warning(
"DeleteConstraint: no constriant found in the articulated figure with the name '%s' for entity '%s' type '%s'.",
7316 constraintName,
self->
name.
c_str(),
self->GetType()->classname );
7331 gameLocal.
Error(
"DeleteConstraint: no constraint with id %d.",
id );
7360 if ( contact->
body1 == body || contact->
body2 == body ) {
7361 contacts[numContacts++] = contact;
7362 if ( numContacts >= maxContacts ) {
7376 if ( linear < 0.0f || linear > 1.0f ||
7377 angular < 0.0f || angular > 1.0f ||
7378 contact < 0.0f || contact > 1.0f ) {
7393 memset( info, 0,
sizeof( *info ) );
7415 bodies[
id]->current->spatialVelocity.SubVec3(0) +=
bodies[
id]->invMass * impulse;
7416 bodies[
id]->current->spatialVelocity.SubVec3(1) += invWorldInertiaTensor * (point -
bodies[
id]->current->worldOrigin).Cross( impulse );
7432 bodies[
id]->current->externalForce.SubVec3( 0 ) += force;
7433 bodies[
id]->current->externalForce.SubVec3( 1 ) += (point -
bodies[
id]->current->worldOrigin).Cross( force );
7521 axis =
bodies[0]->current->worldAxis.Transpose() * newAxis;
7596 return bodies[
id]->current->worldOrigin;
7610 return bodies[
id]->current->worldAxis;
7623 bodies[
id]->current->spatialVelocity.SubVec3( 0 ) = newLinearVelocity;
7636 bodies[
id]->current->spatialVelocity.SubVec3( 1 ) = newAngularVelocity;
7650 return bodies[
id]->current->spatialVelocity.SubVec3( 0 );
7664 return bodies[
id]->current->spatialVelocity.SubVec3( 1 );
7694 results = bodyResults;
7730 results = bodyResults;
7735 partialRotation = rotation * results.
fraction;
7736 results.
endpos =
bodies[0]->current->worldOrigin * partialRotation;
7779 bodies[
i]->clipModel->Disable();
7792 bodies[
i]->clipModel->Enable();
7805 bodies[
i]->clipModel->Unlink();
7869 self->GetMasterPosition( masterOrigin, masterAxis );
void AddForce(const int id, const idVec3 &point, const idVec3 &force)
GLdouble GLdouble GLdouble GLdouble q
idCQuat ToCQuat(void) const
idPlayer * GetLocalPlayer() const
virtual void Save(idSaveGame *saveFile) const
bool InverseFastSelf(void)
void SetBouncyness(float bounce)
idAFBody * GetBody1(void) const
void GetImpactInfo(const int id, const idVec3 &point, impactInfo_t *info) const
idVecX TransposeMultiply(const idVecX &vec) const
~idAFConstraint_UniversalJoint(void)
virtual void GetCenter(idVec3 ¢er)
void ForceBodyId(idAFBody *body, int newId)
virtual void Translate(const idVec3 &translation)
idList< idAFBody * > bodies
void SetSteerAngle(const float degrees)
void InverseWorldSpatialInertiaMultiply(idVecX &dst, const float *v) const
virtual void Rotate(const idRotation &rotation)
virtual void GetForce(idAFBody *body, idVec6 &force)
float GetFriction(void) const
static const float INFINITY
void DrawVelocity(int id, float linearScale, float angularScale) const
virtual void Rotate(const idRotation &rotation)
bool Compare(const idVec3 &a) const
idCVar af_useJointImpulseFriction("af_useJointImpulseFriction","0", CVAR_GAME|CVAR_BOOL,"use impulse based joint friction")
virtual void Rotate(const idRotation &rotation)
idAFConstraint * boxConstraint
void SetAnchor(const idVec3 &worldPosition)
idList< idAFConstraint * > constraints
idMatX inverseWorldSpatialInertia
virtual void DebugDraw(void)
void SetPyramidLimit(const idVec3 &pyramidAxis, const idVec3 &baseAxis, const float angle1, const float angle2, const idVec3 &body1Axis)
int AddBody(idAFBody *body)
virtual void Save(idSaveGame *saveFile) const
void SetPhysics(idPhysics_AF *p)
void cross(float a[], float b[], float c[])
virtual void Evaluate(float invTimeStep)
assert(prefInfo.fullscreenBtn)
virtual void Evaluate(float invTimeStep)
int GetNumConstraints(void) const
void DrawTraceModelSilhouette(const idVec3 &projectionOrigin, const idClipModel *clipModel)
void SetupContactConstraints(void)
idCVar af_forceFriction("af_forceFriction","-1", CVAR_GAME|CVAR_FLOAT,"force the given friction value")
idCVarSystem * cvarSystem
void DebugDraw(const idVec4 &color) const
virtual void GetCenter(idVec3 ¢er)
idAFBody * GetBody2(void) const
idCVar af_skipLimits("af_skipLimits","0", CVAR_GAME|CVAR_BOOL,"skip joint limits")
virtual void Translate(const idVec3 &translation)
void SetDefaultFriction(float linear, float angular, float contact)
idMat3 mat3_identity(idVec3(1, 0, 0), idVec3(0, 1, 0), idVec3(0, 0, 1))
void ReadVec2(idVec2 &vec)
bool GetContactMotorDirection(idVec3 &dir) const
virtual void Restore(idRestoreGame *saveFile)
void SetContactFrictionDent(const float dent, const float start, const float end)
void SetSteerSpeed(const float speed)
virtual void SetBody2(idAFBody *body)
void ApplyImpulse(const int id, const idVec3 &point, const idVec3 &impulse)
idClipModel * GetClipModel(int id=0) const
virtual void DebugArrow(const idVec4 &color, const idVec3 &start, const idVec3 &end, int size, const int lifetime=0)=0
int GetNumBodies(void) const
idAFConstraint * GetConstraint(const char *constraintName) const
virtual void DebugDraw(void)
int GetConstraintId(idAFConstraint *constraint) const
virtual void Translate(const idVec3 &translation)
ID_INLINE void TransposeMultiply(const idMat3 &transpose, const idMat3 &b, idMat3 &dst)
void Printf(const char *fmt,...) const id_attribute((format(printf
idCVar af_showLimits("af_showLimits","0", CVAR_GAME|CVAR_BOOL,"show joint limits")
idCVar af_showInertia("af_showInertia","0", CVAR_GAME|CVAR_BOOL,"show the inertia tensor of each body")
idAFConstraint_Hinge * hinge
virtual void DebugDraw(void)
int maxSubTreeAuxiliaryIndex
idCVar af_showConstrainedBodies("af_showConstrainedBodies","0", CVAR_GAME|CVAR_BOOL,"show the two bodies contrained by the highlighted constraint")
idAFConstraint_BallAndSocketJoint(const idStr &name, idAFBody *body1, idAFBody *body2)
int GetProjectionSilhouetteEdges(const idVec3 &projectionOrigin, int silEdges[MAX_TRACEMODEL_EDGES]) const
void VerifyContactConstraints(void)
void SetAnchor(const idVec3 &pyramidAxis)
idAFConstraint_ConeLimit * coneLimit
void SetDensity(float density, const idMat3 &inertiaScale=mat3_identity)
bool GetFrictionDirection(idVec3 &dir) const
idVec3 GetAxis(void) const
virtual void Translate(const idVec3 &translation)
virtual void GetForce(idAFBody *body, idVec6 &force)
void SetContactMotorDirection(const idVec3 &dir)
const idVecX & GetMultiplier(void)
float GetFloat(void) const
traceModelVert_t verts[MAX_TRACEMODEL_VERTS]
void SetVec(const idVec3 &rotationVec)
int Contacts(contactInfo_t *contacts, const int maxContacts, const idVec3 &start, const idVec6 &dir, const float depth, const idClipModel *mdl, const idMat3 &trmAxis, int contentMask, const idEntity *passEntity)
const float MAX_MOVE_TIME
void SetNum(int newnum, bool resize=true)
idAFConstraint_HingeSteering(void)
void ApplyFriction(float timeStep, float endTimeMSec)
idMat3 ToMat3(void) const
float GetInverseMass(void) const
bool TestIfAtRest(float timeStep)
virtual void Rotate(const idRotation &rotation)
void Save(idSaveGame *savefile) const
float GetFriction(void) const
void Solve(int auxiliaryIndex=0) const
virtual void Translate(const idVec3 &translation)
virtual void Evaluate(float invTimeStep)
const idBounds & GetBounds(int id=-1) const
GLenum GLenum GLenum GLenum GLenum scale
idMat3 Transpose(void) const
void void void void void Error(const char *fmt,...) const id_attribute((format(printf
void SetPushed(int deltaTime)
virtual void Rotate(const idRotation &rotation)
virtual void Rotate(const idRotation &rotation)
idVec6 vec6_origin(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)
void Setup(const char *name, idAFBody *body, const idVec3 &origin, const idMat3 &axis, idClipModel *clipModel)
virtual void Translate(const idVec3 &translation)
void Set(int rows, int columns, const float *src)
virtual void Translate(const idVec3 &translation)
bool IsOutsideWorld(void) const
idAFBody * GetBody(const char *bodyName) const
const idMat3 & GetWorldAxis(void) const
const idMat3 & GetAxis(void) const
const float SUSPEND_LINEAR_VELOCITY
const float NO_MOVE_ROTATION_TOLERANCE
virtual void Translate(const idVec3 &translation)
const idVec3 & GetCenterOfMass(void) const
virtual void Evaluate(float invTimeStep)
idAFConstraint_HingeFriction * fc
idList< idAFConstraint * > constraints
virtual void Save(idSaveGame *saveFile) const
void SetShafts(const idVec3 &cardanShaft1, const idVec3 &cardanShaft2)
virtual void DebugDraw(void)
virtual void Restore(idRestoreGame *saveFile)
idCVar af_showConstraintNames("af_showConstraintNames","0", CVAR_GAME|CVAR_BOOL,"show constraint names")
idAFConstraint_ConeLimit * coneLimit
const idVec6 vec6_lcp_epsilon
bool Add(idPhysics_AF *phys, float invTimeStep)
idCVar af_showConstraints("af_showConstraints","0", CVAR_GAME|CVAR_BOOL,"show constraints")
const idVec3 & SubVec3(int index) const
float GetMass(int id=-1) const
const float NO_MOVE_TRANSLATION_TOLERANCE
void ReadBool(bool &value)
const int AF_VELOCITY_EXPONENT_BITS
virtual void ApplyFriction(float invTimeStep)
static float Sqrt(float x)
const idVec3 GetWheelOrigin(void) const
virtual void Evaluate(float invTimeStep)
idCVar af_showMass("af_showMass","0", CVAR_GAME|CVAR_BOOL,"show the mass of each body")
virtual void ApplyFriction(float invTimeStep)
virtual void SetCVarString(const char *name, const char *value, int flags=0)=0
const idVec3 & GetOrigin(void) const
idList< idAFConstraint * > auxiliaryConstraints
idAFConstraint_Fixed(const idStr &name, idAFBody *body1, idAFBody *body2)
idCVar af_showVelocity("af_showVelocity","0", CVAR_GAME|CVAR_BOOL,"show the velocity of each body")
GLuint GLuint GLsizei GLenum type
const float MIN_MOVE_TIME
traceModelEdge_t edges[MAX_TRACEMODEL_EDGES+1]
idCVar af_showPrimaryOnly("af_showPrimaryOnly","0", CVAR_GAME|CVAR_BOOL,"show primary constraints only")
virtual void ApplyFriction(float invTimeStep)
idMat3 GetInverseWorldInertia(void) const
idMatX Transpose(void) const
float GetContactFrictionScale(void) const
float GetContactMotorForce(void) const
const int AF_FORCE_EXPONENT_BITS
void SortBodies_r(idList< idAFBody * > &sortedList, idAFBody *body)
virtual void ApplyImpulse(idEntity *ent, int id, const idVec3 &point, const idVec3 &impulse)
void MultiplySub(idVecX &dst, const idVecX &vec) const
float GetAngle(void) const
double Milliseconds(void) const
idVec3 Cross(const idVec3 &a) const
idList< idAFBody * > sortedBodies
void Setup(idAFConstraint_BallAndSocketJoint *cc)
virtual void DrawModel(cmHandle_t model, const idVec3 &modelOrigin, const idMat3 &modelAxis, const idVec3 &viewOrigin, const float radius)=0
void Setup(idAFBody *b1, idAFBody *b2, const idVec3 &pyramidAnchor, const idVec3 &pyramidAxis, const idVec3 &baseAxis, const float pyramidAngle1, const float pyramidAngle2, const idVec3 &body1Axis)
idAFConstraint_BallAndSocketJointFriction(void)
const float LIMIT_LCP_EPSILON
void SetEpsilon(const float e)
const float * ToFloatPtr(void) const
void OrthogonalBasis(idVec3 &left, idVec3 &up) const
float contactMotorVelocity
void AddForce(const idVec3 &point, const idVec3 &force)
virtual void Rotate(const idRotation &rotation)
float GetFriction(void) const
void WriteVec3(const idVec3 &vec)
const idMat3 & GetAxis(int id=0) const
idCVar af_highlightConstraint("af_highlightConstraint","", CVAR_GAME,"name of the constraint to highlight")
idAFConstraint_HingeSteering * steering
void SetMaster(idEntity *master, const bool orientated=true)
bool Add(idPhysics_AF *phys, float invTimeStep)
virtual void ApplyFriction(float invTimeStep)
float contactFrictionDentStart
static idVec4 & ColorForIndex(int i)
idCVar af_showTrees("af_showTrees","0", CVAR_GAME|CVAR_BOOL,"show tree-like structures")
void ReadVec6(idVec6 &vec)
idMatX InverseFast(void) const
void SetAxis(const idVec3 &ax)
idAFConstraint_Line(const idStr &name, idAFBody *body1, idAFBody *body2)
virtual void Rotate(const idRotation &rotation)
idList< idAFConstraint_Contact * > contactConstraints
idAFConstraint_HingeFriction(void)
idCVar af_highlightBody("af_highlightBody","", CVAR_GAME,"name of the body to highlight")
const idVec3 & GetAngularVelocity(int id=0) const
const int AF_FORCE_TOTAL_BITS
virtual void ApplyFriction(float invTimeStep)
void SetAnchor(const idVec3 &coneAnchor)
virtual void Rotate(const idRotation &rotation)
void SetSuspension(const float up, const float down, const float k, const float d, const float f)
void MultiplyAdd(idVecX &dst, const idVecX &vec) const
virtual void DebugDraw(void)
void SetFriction(float linear, float angular, float contact)
void WriteBool(const bool value)
void AddFrameConstraint(idAFConstraint *constraint)
bool Evaluate(int timeStepMSec, int endTimeMSec)
virtual void Translate(const idVec3 &translation)
virtual void ApplyFriction(float invTimeStep)
virtual void ApplyFriction(float invTimeStep)
void TransposeMultiplySub(idVecX &dst, const idVecX &vec) const
static idLCP * AllocSymmetric(void)
struct idAFConstraint::constraintFlags_s fl
void void void Warning(const char *fmt,...) const id_attribute((format(printf
void SetConeLimit(const idVec3 &coneAxis, const float coneAngle)
virtual void ApplyFriction(float invTimeStep)
virtual void Evaluate(float invTimeStep)
void AddFrameConstraints(void)
void DeleteBody(const char *bodyName)
const float IMPULSE_THRESHOLD
virtual void Restore(idRestoreGame *saveFile)
void SetAnchor(const idVec3 &worldPosition)
const idBounds & GetAbsBounds(int id=-1) const
idAFConstraint_BallAndSocketJoint * joint
void SetLimit(const float minLength, const float maxLength)
GLfloat GLfloat GLfloat v2
idVecX Multiply(const idVecX &vec) const
void ApplyContactForces(void)
bool Add(idPhysics_AF *phys, float invTimeStep)
float GetAngle(void) const
void SetFrictionDirection(const idVec3 &dir)
GLint GLint GLint GLint j2
int GetNumColumns(void) const
idVec3 GetAnchor(void) const
virtual void Restore(idRestoreGame *saveFile)
virtual void DebugCone(const idVec4 &color, const idVec3 &apex, const idVec3 &dir, float radius1, float radius2, const int lifetime=0)=0
virtual void Evaluate(float invTimeStep)
void SetTimeScaleRamp(const float start, const float end)
idVec3 GetAnchor(void) const
idCVar af_showTimings("af_showTimings","0", CVAR_GAME|CVAR_BOOL,"show articulated figure cpu usage")
virtual void GetCenter(idVec3 ¢er)
virtual void DebugLine(const idVec4 &color, const idVec3 &start, const idVec3 &end, const int lifetime=0, const bool depthTest=false)=0
float contactFrictionDentEnd
void GetMassProperties(const float density, float &mass, idVec3 ¢erOfMass, idMat3 &inertiaTensor) const
virtual void Rotate(const idRotation &rotation)
idAFConstraint_Slider(const idStr &name, idAFBody *body1, idAFBody *body2)
void SetMass(float mass, int id=-1)
void WriteToSnapshot(idBitMsgDelta &msg) const
virtual void Restore(idRestoreGame *saveFile)
GLubyte GLubyte GLubyte GLubyte w
void ReadFloat(float &value)
void SetSteerSpeed(const float speed)
bool EvaluateContacts(void)
void WriteDeltaFloat(float oldValue, float newValue)
virtual void Rotate(const idRotation &rotation)
void SetContents(int contents, int id=-1)
void SetPlane(const idVec3 &normal, const idVec3 &anchor)
virtual void ApplyFriction(float invTimeStep)
void SetAnchor(const idVec3 &worldAnchor1, const idVec3 &worldAnchor2)
int GetNumClipModels(void) const
idVec3 vec3_origin(0.0f, 0.0f, 0.0f)
bool Add(idPhysics_AF *phys, float invTimeStep)
virtual void Restore(idRestoreGame *saveFile)
bool IsDiagonal(const float epsilon=MATRIX_EPSILON) const
const idVec3 & SubVec3(int index) const
void SetOrigin(const idVec3 &newOrigin, int id=-1)
float GetJointFrictionScale(void) const
idVec3 GetAnchor(void) const
float contactFrictionScale
int GetContents(int id=-1) const
const idVec6 & SubVec6(int row) const
virtual void Translate(const idVec3 &translation)
virtual void GetImpactInfo(idEntity *ent, int id, const idVec3 &point, impactInfo_t *info)
void WriteFloat(const float value)
virtual void Save(idSaveGame *saveFile) const
void Restore(idRestoreGame *savefile)
virtual void GetCenter(idVec3 ¢er)
virtual void DebugDraw(void)
static float Fabs(float f)
idVec6 & GetResponseForce(int index)
#define INTSIGNBITNOTSET(i)
cmHandle_t Handle(void) const
idVec2 suspendAcceleration
idCVar af_showTotalMass("af_showTotalMass","0", CVAR_GAME|CVAR_BOOL,"show the total mass of each articulated figure")
virtual void Evaluate(float invTimeStep)
virtual void ApplyFriction(float invTimeStep)
virtual void ApplyFriction(float invTimeStep)
const int AF_VELOCITY_MANTISSA_BITS
void CheckForCollisions(float timeStep)
void PrimaryForces(float timeStep)
const float * ToFloatPtr(void) const
idCVar af_maxAngularVelocity("af_maxAngularVelocity","1.57", CVAR_GAME|CVAR_FLOAT,"maximum angular velocity")
virtual void Evaluate(float invTimeStep)
int GetInteger(void) const
idCVar af_showActive("af_showActive","0", CVAR_GAME|CVAR_BOOL,"show tree-like structures of articulated figures not at rest")
idAFConstraint_PyramidLimit * pyramidLimit
virtual void DebugDraw(void)
virtual void Translate(const idVec3 &translation)
void WriteVec6(const idVec6 &vec)
void SetLimitEpsilon(const float e)
void CalculateForces(float timeStep) const
virtual void Evaluate(float invTimeStep)
void SetSuspendSpeed(const idVec2 &velocity, const idVec2 &acceleration)
void SetClipModel(idClipModel *clipModel)
virtual void ApplyFriction(float invTimeStep)
idCVar af_useLinearTime("af_useLinearTime","1", CVAR_GAME|CVAR_BOOL,"use linear time algorithm for tree-like structures")
const char * ToString(int precision=2) const
virtual void Save(idSaveGame *saveFile) const
virtual void Restore(idRestoreGame *saveFile)
bool IsTraceModel(void) const
int GetNumRows(void) const
void TransposeMultiplyAdd(idVecX &dst, const idVecX &vec) const
const float CENTER_OF_MASS_EPSILON
bool IsAtRest(void) const
idCVar af_showBodyNames("af_showBodyNames","0", CVAR_GAME|CVAR_BOOL,"show body names")
void Save(idSaveGame *saveFile)
int ClipContents(const idClipModel *model) const
virtual void Rotate(const idRotation &rotation)
END_CLASS const float ERROR_REDUCTION
void idPhysics_AF_SavePState(idSaveGame *saveFile, const AFPState_t &state)
const float ERROR_REDUCTION_MAX
idAFConstraint_UniversalJoint * joint
type * Find(type const &obj) const
virtual void Save(idSaveGame *saveFile) const
idAFConstraint_Suspension(void)
const idVec3 & GetLinearVelocity(int id=0) const
float ReadDeltaFloat(float oldValue) const
const idVec3 & GetPushedLinearVelocity(const int id=0) const
float jointFrictionDentStart
float GetBouncyness(void) const
void DeleteContents(bool clear)
~idAFConstraint_BallAndSocketJoint(void)
virtual void Translate(const idVec3 &translation)
void Response(const idAFConstraint *constraint, int row, int auxiliaryIndex) const
virtual void DrawText(const char *text, const idVec3 &origin, float scale, const idVec4 &color, const idMat3 &viewAxis, const int align=1, const int lifetime=0, bool depthTest=false)=0
void FromTransformedBounds(const idBounds &bounds, const idVec3 &origin, const idMat3 &axis)
virtual void Translate(const idVec3 &translation)
virtual void Restore(idRestoreGame *saveFile)
virtual void DebugDraw(void)
static float InvSqrt(float x)
void idPhysics_AF_RestorePState(idRestoreGame *saveFile, AFPState_t &state)
virtual void Evaluate(float invTimeStep)
idAFConstraint_Hinge(const idStr &name, idAFBody *body1, idAFBody *body2)
float LengthSqr(void) const
void SetAxis(const idMat3 &newAxis, int id=-1)
virtual void Translate(const idVec3 &translation)
idList< AFCollision_t > collisions
void SetLinearVelocity(const idVec3 &newLinearVelocity, int id=0)
void SetLinearVelocity(const idVec3 &linear) const
GLubyte GLubyte GLubyte a
void SetAnchor(const idVec3 &worldPosition)
idAFConstraint_BallAndSocketJointFriction * fc
void SetLimit(const idVec3 &axis, const float angle, const idVec3 &body1Axis)
void AuxiliaryForces(float timeStep)
const idVec3 & GetPushedAngularVelocity(const int id=0) const
const idVec6 & SubVec6(int index) const
void SetJointFrictionDent(const float dent, const float start, const float end)
void ClearExternalForce(void)
static int BitsForInteger(int i)
void AssureSizeAlloc(int newSize, new_t *allocator)
float contactFrictionDentScale
idMat3 & OrthoNormalizeSelf(void)
virtual ~idAFConstraint(void)
virtual void Evaluate(float invTimeStep)
virtual void Translate(const idVec3 &translation)
idCVar af_showBodies("af_showBodies","0", CVAR_GAME|CVAR_BOOL,"show bodies")
void WriteInt(const int value)
bool ApplyCollisions(float timeStep)
virtual void Save(idSaveGame *saveFile) const
idCVar af_jointFrictionScale("af_jointFrictionScale","0", CVAR_GAME|CVAR_FLOAT,"scales the joint friction")
idAFConstraint_UniversalJointFriction(void)
idAFConstraint_Spring(const idStr &name, idAFBody *body1, idAFBody *body2)
void WriteMat3(const idMat3 &mat)
void SetAxis(const idVec3 &axis)
idList< idAFTree * > trees
void SetAngularVelocity(const idVec3 &angular) const
idAFConstraint_Hinge * hinge
bool worldConstraintsLocked
idList< contactInfo_t > contacts
virtual void DebugDraw(void)
int GetBodyId(idAFBody *body) const
const idVec3 & GetVec(void) const
void ReadMat3(idMat3 &mat)
idEntity * entities[MAX_GENTITIES]
void ClipTranslation(trace_t &results, const idVec3 &translation, const idClipModel *model) const
void SetLimitEpsilon(const float e)
idCVar af_skipSelfCollision("af_skipSelfCollision","0", CVAR_GAME|CVAR_BOOL,"skip self collision detection")
void Evolve(float timeStep)
const char * GetString(void) const
const float SUSPEND_ANGULAR_ACCELERATION
void ClipRotation(trace_t &results, const idRotation &rotation, const idClipModel *model) const
#define MAX_TRACEMODEL_EDGES
bool Add(idPhysics_AF *phys, float invTimeStep)
virtual void Save(idSaveGame *saveFile) const
void SetEpsilon(const float e)
void AddContactEntitiesForContacts(void)
idAFConstraint_PyramidLimit * pyramidLimit
int Append(const type &obj)
GLdouble GLdouble GLdouble r
void SetSuspendTolerance(const float noMoveTime, const float translationTolerance, const float rotationTolerance)
idMat3 inverseInertiaTensor
void Setup(idAFBody *b1, idAFBody *b2, const idVec3 &coneAnchor, const idVec3 &coneAxis, const float coneAngle, const idVec3 &body1Axis)
void ReadFromSnapshot(const idBitMsgDelta &msg)
void SetSteerAngle(const float degrees)
void UpdateClipModels(void)
void AddConstraint(idAFConstraint *constraint)
void SetSize(int rows, int columns)
virtual void Evaluate(float invTimeStep)
void SetConeLimit(const idVec3 &coneAxis, const float coneAngle, const idVec3 &body1Axis)
GLenum GLenum GLvoid * row
const idVec3 & GetWorldOrigin(void) const
void SetOrigin(const idVec3 &rotationOrigin)
idAFConstraint_PyramidLimit(void)
const float CONTACT_LCP_EPSILON
virtual void Save(idSaveGame *saveFile) const
virtual void Restore(idRestoreGame *saveFile)
bool Add(idPhysics_AF *phys, float invTimeStep)
idMat3 ToMat3(void) const
virtual void Translate(const idVec3 &translation)
void Setup(idAFConstraint_Hinge *cc)
idList< idAFConstraint * > frameConstraints
const idMat3 & ToMat3(void) const
virtual void AddForce(idEntity *ent, int id, const idVec3 &point, const idVec3 &force)
bool RemoveIndex(int index)
virtual void ApplyFriction(float invTimeStep)
idAFConstraint_ConeLimit(void)
float GetContactFriction(void) const
virtual void GetCenter(idVec3 ¢er)
idMat3 ToMat3(void) const
virtual void SetBody1(idAFBody *body)
idCVar af_timeScale("af_timeScale","1", CVAR_GAME|CVAR_FLOAT,"scales the time")
virtual void Save(idSaveGame *saveFile) const
void ChangeSize(int size, bool makeZero=false)
idList< int > contactBodies
idAFConstraint * primaryConstraint
virtual void GetCenter(idVec3 ¢er)
void UpdateTime(int endTimeMSec)
const float SUSPEND_LINEAR_ACCELERATION
bool Rotation(trace_t &results, const idVec3 &start, const idRotation &rotation, const idClipModel *mdl, const idMat3 &trmAxis, int contentMask, const idEntity *passEntity)
virtual void Rotate(const idRotation &rotation)
void SetData(int rows, int columns, float *data)
void Translate(const idVec3 &translation, int id=-1)
void DeleteConstraint(const char *constraintName)
int Contents(const idVec3 &start, const idClipModel *mdl, const idMat3 &trmAxis, int contentMask, const idEntity *passEntity)
void RotationModel(trace_t &results, const idVec3 &start, const idRotation &rotation, const idClipModel *mdl, const idMat3 &trmAxis, int contentMask, cmHandle_t model, const idVec3 &modelOrigin, const idMat3 &modelAxis)
int ContentsModel(const idVec3 &start, const idClipModel *mdl, const idMat3 &trmAxis, int contentMask, cmHandle_t model, const idVec3 &modelOrigin, const idMat3 &modelAxis)
#define CLASS_DECLARATION(nameofsuperclass, nameofclass)
const idVec3 & GetAngularVelocity(void) const
GLsizei const GLcharARB const GLint * length
void WriteVec2(const idVec2 &vec)
idAFBody * GetMasterBody(void) const
idAFConstraint_CylindricalJoint(const idStr &name, idAFBody *body1, idAFBody *body2)
const float SUSPEND_ANGULAR_VELOCITY
idCVar af_maxLinearVelocity("af_maxLinearVelocity","128", CVAR_GAME|CVAR_FLOAT,"maximum linear velocity")
float jointFrictionDentScale
void SetSpring(const float stretch, const float compress, const float damping, const float restLength)
void SetSuspendTime(const float minTime, const float maxTime)
void ReadVec3(idVec3 &vec)
void GetAxis(idVec3 &a1, idVec3 &a2) const
virtual void DebugCircle(const idVec4 &color, const idVec3 &origin, const idVec3 &dir, const float radius, const int numSteps, const int lifetime=0, const bool depthTest=false)=0
idAFConstraint_Plane(const idStr &name, idAFBody *body1, idAFBody *body2)
~idAFConstraint_Hinge(void)
void SetData(int length, float *data)
virtual void ApplyFriction(float invTimeStep)
int NumAllocated(void) const
void SetClipModel(idClipModel *model, float density, int id=0, bool freeOld=true)
void GetShafts(idVec3 &cardanShaft1, idVec3 &cardanShaft2)
const char * c_str(void) const
virtual void GetForce(idAFBody *body, idVec6 &force)
idRotation ToRotation(void) const
void AddPushVelocity(const idVec6 &pushVelocity)
void TranslationModel(trace_t &results, const idVec3 &start, const idVec3 &end, const idClipModel *mdl, const idMat3 &trmAxis, int contentMask, cmHandle_t model, const idVec3 &modelOrigin, const idMat3 &modelAxis)
bool IsPushable(void) const
idVec6 vec6_infinity(idMath::INFINITY, idMath::INFINITY, idMath::INFINITY, idMath::INFINITY, idMath::INFINITY, idMath::INFINITY)
struct idAFBody::bodyFlags_s fl
idList< idAFConstraint * > primaryConstraints
int FindIndex(const type &obj) const
virtual void DebugDraw(void)
idMat3 mat3_zero(idVec3(0, 0, 0), idVec3(0, 0, 0), idVec3(0, 0, 0))
float ReadFloat(void) const
virtual void DebugDraw(void)
void Setup(idAFConstraint_Hinge *cc)
virtual void Restore(idRestoreGame *saveFile)
void SetPyramidLimit(const idVec3 &pyramidAxis, const idVec3 &baseAxis, const float angle1, const float angle2)
void Set(const float x, const float y)
float contactFrictionDent
virtual void SetBody1(idAFBody *body)
void SetAngularVelocity(const idVec3 &newAngularVelocity, int id=0)
virtual void Restore(idRestoreGame *saveFile)
virtual void DebugDraw(void)
const idStr & GetName(void) const
ID_INLINE idMat3 SkewSymmetric(idVec3 const &src)
void ActivateContactEntities(void)
const idTraceModel * GetTraceModel(void) const
idVec3 GetPointVelocity(const idVec3 &point) const
idAFConstraint_UniversalJoint(const idStr &name, idAFBody *body1, idAFBody *body2)
void Clamp(float min, float max)
idCVar af_useSymmetry("af_useSymmetry","1", CVAR_GAME|CVAR_BOOL,"use constraint matrix symmetry")
virtual void Evaluate(float invTimeStep)
if(!ValidDisplayID(prefInfo.prefDisplayID)) prefInfo.prefDisplayID
const int AF_FORCE_MANTISSA_BITS
idRenderWorld * gameRenderWorld
char * va(const char *fmt,...)
void Rotate(const idRotation &rotation, int id=-1)
bool Translation(trace_t &results, const idVec3 &start, const idVec3 &end, const idClipModel *mdl, const idMat3 &trmAxis, int contentMask, const idEntity *passEntity)
virtual void ApplyFriction(float invTimeStep)
idCVar af_useImpulseFriction("af_useImpulseFriction","0", CVAR_GAME|CVAR_BOOL,"use impulse based contact friction")
void RemoveFrameConstraints(void)
void SetBody1Axis(const idVec3 &body1Axis)
void SetBody1Axis(const idVec3 &body1Axis)
virtual void GetCenter(idVec3 ¢er)
void ChangeSize(int rows, int columns, bool makeZero=false)
virtual void Rotate(const idRotation &rotation)
idMat3 Inverse(void) const
virtual bool Solve(const idMatX &A, idVecX &x, const idVecX &b, const idVecX &lo, const idVecX &hi, const int *boxIndex=NULL)=0
float jointFrictionDentEnd
const float * ToFloatPtr(void) const
virtual void Evaluate(float invTimeStep)
float suspensionKCompress
virtual void ApplyFriction(float invTimeStep)
idCVar af_contactFrictionScale("af_contactFrictionScale","0", CVAR_GAME|CVAR_FLOAT,"scales the contact friction")
void EvaluateConstraints(float timeStep)
idAFConstraint_UniversalJointFriction * fc
virtual void Evaluate(float invTimeStep)
idEntity * SetupCollisionForBody(idAFBody *body) const
void NormalVectors(idVec3 &left, idVec3 &down) const
static const float M_MS2SEC
void EvaluateBodies(float timeStep)
const idVec3 & GetLinearVelocity(void) const
idCollisionModelManager * collisionModelManager
bool CollisionImpulse(float timeStep, idAFBody *body, trace_t &collision)
idList< idAFBody * > children
idCVar af_skipFriction("af_skipFriction","0", CVAR_GAME|CVAR_BOOL,"skip friction")
bool IsClosedLoop(const idAFBody *body1, const idAFBody *body2) const
int GetRestStartTime(void) const
virtual void Rotate(const idRotation &rotation)
virtual void Evaluate(float invTimeStep)
bool Motion(trace_t &results, const idVec3 &start, const idVec3 &end, const idRotation &rotation, const idClipModel *mdl, const idMat3 &trmAxis, int contentMask, const idEntity *passEntity)
virtual void GetForce(idAFBody *body, idVec6 &force)
void SetLimitEpsilon(const float e)
float GetContactMotorVelocity(void) const
void Setup(idAFConstraint_UniversalJoint *cc)
const int AF_VELOCITY_TOTAL_BITS
void Restore(idRestoreGame *saveFile)
const idVec3 & GetOrigin(int id=0) const
const idStr & GetName(void) const
virtual void Rotate(const idRotation &rotation)
virtual void ApplyFriction(float invTimeStep)
static int BitsForFloat(float f)
virtual void SetBody2(idAFBody *body)
virtual void DebugDraw(void)
virtual void Save(idSaveGame *saveFile) const
void SetAngle(const float rotationAngle)
const float AF_VELOCITY_MAX
bool spatialInertiaSparse
virtual void Rotate(const idRotation &rotation)
idAFConstraint_ConeLimit * coneLimit
const float LIMIT_ERROR_REDUCTION
void SetMaxSubTreeAuxiliaryIndex(void)
virtual void Translate(const idVec3 &translation)
int GetBodyContactConstraints(const int id, idAFConstraint_Contact *contacts[], int maxContacts) const