Bullet Collision Detection & Physics Library: btSliderConstraint.cpp Source File

Bullet Collision Detection & Physics Library

btSliderConstraint.cpp
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
4
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
10
11 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
14 */
15
16 /*
17 Added by Roman Ponomarev (rponom@gmail.com)
18 April 04, 2008
19 */
20
21
22
23 #include "btSliderConstraint.h"
24 #include "BulletDynamics/Dynamics/btRigidBody.h"
25 #include "LinearMath/btTransformUtil.h"
26 #include <new>
27
28 #define USE_OFFSET_FOR_CONSTANT_FRAME true
29
30 void btSliderConstraint::initParams()
31 {
32 m_lowerLinLimit = btScalar(1.0);
33 m_upperLinLimit = btScalar(-1.0);
34 m_lowerAngLimit = btScalar(0.);
35 m_upperAngLimit = btScalar(0.);
36 m_softnessDirLin = SLIDER_CONSTRAINT_DEF_SOFTNESS;
37 m_restitutionDirLin = SLIDER_CONSTRAINT_DEF_RESTITUTION;
38 m_dampingDirLin = btScalar(0.);
39 m_cfmDirLin = SLIDER_CONSTRAINT_DEF_CFM;
40 m_softnessDirAng = SLIDER_CONSTRAINT_DEF_SOFTNESS;
41 m_restitutionDirAng = SLIDER_CONSTRAINT_DEF_RESTITUTION;
42 m_dampingDirAng = btScalar(0.);
43 m_cfmDirAng = SLIDER_CONSTRAINT_DEF_CFM;
44 m_softnessOrthoLin = SLIDER_CONSTRAINT_DEF_SOFTNESS;
45 m_restitutionOrthoLin = SLIDER_CONSTRAINT_DEF_RESTITUTION;
46 m_dampingOrthoLin = SLIDER_CONSTRAINT_DEF_DAMPING;
47 m_cfmOrthoLin = SLIDER_CONSTRAINT_DEF_CFM;
48 m_softnessOrthoAng = SLIDER_CONSTRAINT_DEF_SOFTNESS;
49 m_restitutionOrthoAng = SLIDER_CONSTRAINT_DEF_RESTITUTION;
50 m_dampingOrthoAng = SLIDER_CONSTRAINT_DEF_DAMPING;
51 m_cfmOrthoAng = SLIDER_CONSTRAINT_DEF_CFM;
52 m_softnessLimLin = SLIDER_CONSTRAINT_DEF_SOFTNESS;
53 m_restitutionLimLin = SLIDER_CONSTRAINT_DEF_RESTITUTION;
54 m_dampingLimLin = SLIDER_CONSTRAINT_DEF_DAMPING;
55 m_cfmLimLin = SLIDER_CONSTRAINT_DEF_CFM;
56 m_softnessLimAng = SLIDER_CONSTRAINT_DEF_SOFTNESS;
57 m_restitutionLimAng = SLIDER_CONSTRAINT_DEF_RESTITUTION;
58 m_dampingLimAng = SLIDER_CONSTRAINT_DEF_DAMPING;
59 m_cfmLimAng = SLIDER_CONSTRAINT_DEF_CFM;
60
61 m_poweredLinMotor = false;
62 m_targetLinMotorVelocity = btScalar(0.);
63 m_maxLinMotorForce = btScalar(0.);
64 m_accumulatedLinMotorImpulse = btScalar(0.0);
65
66 m_poweredAngMotor = false;
67 m_targetAngMotorVelocity = btScalar(0.);
68 m_maxAngMotorForce = btScalar(0.);
69 m_accumulatedAngMotorImpulse = btScalar(0.0);
70
71 m_flags = 0;
72 m_flags = 0;
73
74 m_useOffsetForConstraintFrame = USE_OFFSET_FOR_CONSTANT_FRAME;
75
76 calculateTransforms(m_rbA.getCenterOfMassTransform(),m_rbB.getCenterOfMassTransform());
77 }
78
79
80
81
82
83 btSliderConstraint::btSliderConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB, bool useLinearReferenceFrameA)
84 : btTypedConstraint(SLIDER_CONSTRAINT_TYPE, rbA, rbB),
85 m_useSolveConstraintObsolete(false),
86 m_frameInA(frameInA),
87 m_frameInB(frameInB),
88 m_useLinearReferenceFrameA(useLinearReferenceFrameA)
89 {
90 initParams();
91 }
92
93
94
95 btSliderConstraint::btSliderConstraint(btRigidBody& rbB, const btTransform& frameInB, bool useLinearReferenceFrameA)
96 : btTypedConstraint(SLIDER_CONSTRAINT_TYPE, getFixedBody(), rbB),
97 m_useSolveConstraintObsolete(false),
98 m_frameInB(frameInB),
99 m_useLinearReferenceFrameA(useLinearReferenceFrameA)
100 {
102 m_frameInA = rbB.getCenterOfMassTransform() * m_frameInB;
103 // m_frameInA.getOrigin() = m_rbA.getCenterOfMassTransform()(m_frameInA.getOrigin());
104
105 initParams();
106 }
107
108
109
110
111
112
113 void btSliderConstraint::getInfo1(btConstraintInfo1* info)
114 {
115 if (m_useSolveConstraintObsolete)
116 {
117 info->m_numConstraintRows = 0;
118 info->nub = 0;
119 }
120 else
121 {
122 info->m_numConstraintRows = 4; // Fixed 2 linear + 2 angular
123 info->nub = 2;
124 //prepare constraint
125 calculateTransforms(m_rbA.getCenterOfMassTransform(),m_rbB.getCenterOfMassTransform());
126 testAngLimits();
127 testLinLimits();
128 if(getSolveLinLimit() || getPoweredLinMotor())
129 {
130 info->m_numConstraintRows++; // limit 3rd linear as well
131 info->nub--;
132 }
133 if(getSolveAngLimit() || getPoweredAngMotor())
134 {
135 info->m_numConstraintRows++; // limit 3rd angular as well
136 info->nub--;
137 }
138 }
139 }
140
141 void btSliderConstraint::getInfo1NonVirtual(btConstraintInfo1* info)
142 {
143
144 info->m_numConstraintRows = 6; // Fixed 2 linear + 2 angular + 1 limit (even if not used)
145 info->nub = 0;
146 }
147
148 void btSliderConstraint::getInfo2(btConstraintInfo2* info)
149 {
150 getInfo2NonVirtual(info,m_rbA.getCenterOfMassTransform(),m_rbB.getCenterOfMassTransform(), m_rbA.getLinearVelocity(),m_rbB.getLinearVelocity(), m_rbA.getInvMass(),m_rbB.getInvMass());
151 }
152
153
154
155
156
157
158
159 void btSliderConstraint::calculateTransforms(const btTransform& transA,const btTransform& transB)
160 {
161 if(m_useLinearReferenceFrameA || (!m_useSolveConstraintObsolete))
162 {
163 m_calculatedTransformA = transA * m_frameInA;
164 m_calculatedTransformB = transB * m_frameInB;
165 }
166 else
167 {
168 m_calculatedTransformA = transB * m_frameInB;
169 m_calculatedTransformB = transA * m_frameInA;
170 }
171 m_realPivotAInW = m_calculatedTransformA.getOrigin();
172 m_realPivotBInW = m_calculatedTransformB.getOrigin();
173 m_sliderAxis = m_calculatedTransformA.getBasis().getColumn(0); // along X
174 if(m_useLinearReferenceFrameA || m_useSolveConstraintObsolete)
175 {
176 m_delta = m_realPivotBInW - m_realPivotAInW;
177 }
178 else
179 {
180 m_delta = m_realPivotAInW - m_realPivotBInW;
181 }
182 m_projPivotInW = m_realPivotAInW + m_sliderAxis.dot(m_delta) * m_sliderAxis;
183 btVector3 normalWorld;
184 int i;
185 //linear part
186 for(i = 0; i < 3; i++)
187 {
188 normalWorld = m_calculatedTransformA.getBasis().getColumn(i);
189 m_depth[i] = m_delta.dot(normalWorld);
190 }
191 }
192
193
194
195 void btSliderConstraint::testLinLimits(void)
196 {
197 m_solveLinLim = false;
198 m_linPos = m_depth[0];
199 if(m_lowerLinLimit <= m_upperLinLimit)
200 {
201 if(m_depth[0] > m_upperLinLimit)
202 {
203 m_depth[0] -= m_upperLinLimit;
204 m_solveLinLim = true;
205 }
206 else if(m_depth[0] < m_lowerLinLimit)
207 {
208 m_depth[0] -= m_lowerLinLimit;
209 m_solveLinLim = true;
210 }
211 else
212 {
213 m_depth[0] = btScalar(0.);
214 }
215 }
216 else
217 {
218 m_depth[0] = btScalar(0.);
219 }
220 }
221
222
223
224 void btSliderConstraint::testAngLimits(void)
225 {
226 m_angDepth = btScalar(0.);
227 m_solveAngLim = false;
228 if(m_lowerAngLimit <= m_upperAngLimit)
229 {
230 const btVector3 axisA0 = m_calculatedTransformA.getBasis().getColumn(1);
231 const btVector3 axisA1 = m_calculatedTransformA.getBasis().getColumn(2);
232 const btVector3 axisB0 = m_calculatedTransformB.getBasis().getColumn(1);
233 // btScalar rot = btAtan2Fast(axisB0.dot(axisA1), axisB0.dot(axisA0));
234 btScalar rot = btAtan2(axisB0.dot(axisA1), axisB0.dot(axisA0));
235 rot = btAdjustAngleToLimits(rot, m_lowerAngLimit, m_upperAngLimit);
236 m_angPos = rot;
237 if(rot < m_lowerAngLimit)
238 {
239 m_angDepth = rot - m_lowerAngLimit;
240 m_solveAngLim = true;
241 }
242 else if(rot > m_upperAngLimit)
243 {
244 m_angDepth = rot - m_upperAngLimit;
245 m_solveAngLim = true;
246 }
247 }
248 }
249
250 btVector3 btSliderConstraint::getAncorInA(void)
251 {
252 btVector3 ancorInA;
253 ancorInA = m_realPivotAInW + (m_lowerLinLimit + m_upperLinLimit) * btScalar(0.5) * m_sliderAxis;
254 ancorInA = m_rbA.getCenterOfMassTransform().inverse() * ancorInA;
255 return ancorInA;
256 }
257
258
259
260 btVector3 btSliderConstraint::getAncorInB(void)
261 {
262 btVector3 ancorInB;
263 ancorInB = m_frameInB.getOrigin();
264 return ancorInB;
265 }
266
267
268 void btSliderConstraint::getInfo2NonVirtual(btConstraintInfo2* info, const btTransform& transA,const btTransform& transB, const btVector3& linVelA,const btVector3& linVelB, btScalar rbAinvMass,btScalar rbBinvMass )
269 {
270 const btTransform& trA = getCalculatedTransformA();
271 const btTransform& trB = getCalculatedTransformB();
272
273 btAssert(!m_useSolveConstraintObsolete);
274 int i, s = info->rowskip;
275
276 btScalar signFact = m_useLinearReferenceFrameA ? btScalar(1.0f) : btScalar(-1.0f);
277
278 // difference between frames in WCS
279 btVector3 ofs = trB.getOrigin() - trA.getOrigin();
280 // now get weight factors depending on masses
281 btScalar miA = rbAinvMass;
282 btScalar miB = rbBinvMass;
283 bool hasStaticBody = (miA < SIMD_EPSILON) || (miB < SIMD_EPSILON);
284 btScalar miS = miA + miB;
285 btScalar factA, factB;
286 if(miS > btScalar(0.f))
287 {
288 factA = miB / miS;
289 }
290 else
291 {
292 factA = btScalar(0.5f);
293 }
294 factB = btScalar(1.0f) - factA;
295 btVector3 ax1, p, q;
296 btVector3 ax1A = trA.getBasis().getColumn(0);
297 btVector3 ax1B = trB.getBasis().getColumn(0);
298 if(m_useOffsetForConstraintFrame)
299 {
300 // get the desired direction of slider axis
301 // as weighted sum of X-orthos of frameA and frameB in WCS
302 ax1 = ax1A * factA + ax1B * factB;
303 ax1.normalize();
304 // construct two orthos to slider axis
305 btPlaneSpace1 (ax1, p, q);
306 }
307 else
308 { // old way - use frameA
309 ax1 = trA.getBasis().getColumn(0);
310 // get 2 orthos to slider axis (Y, Z)
311 p = trA.getBasis().getColumn(1);
312 q = trA.getBasis().getColumn(2);
313 }
314 // make rotations around these orthos equal
315 // the slider axis should be the only unconstrained
316 // rotational axis, the angular velocity of the two bodies perpendicular to
317 // the slider axis should be equal. thus the constraint equations are
318 // p*w1 - p*w2 = 0
319 // q*w1 - q*w2 = 0
320 // where p and q are unit vectors normal to the slider axis, and w1 and w2
321 // are the angular velocity vectors of the two bodies.
322 info->m_J1angularAxis[0] = p[0];
323 info->m_J1angularAxis[1] = p[1];
324 info->m_J1angularAxis[2] = p[2];
325 info->m_J1angularAxis[s+0] = q[0];
326 info->m_J1angularAxis[s+1] = q[1];
327 info->m_J1angularAxis[s+2] = q[2];
328
329 info->m_J2angularAxis[0] = -p[0];
330 info->m_J2angularAxis[1] = -p[1];
331 info->m_J2angularAxis[2] = -p[2];
332 info->m_J2angularAxis[s+0] = -q[0];
333 info->m_J2angularAxis[s+1] = -q[1];
334 info->m_J2angularAxis[s+2] = -q[2];
335 // compute the right hand side of the constraint equation. set relative
336 // body velocities along p and q to bring the slider back into alignment.
337 // if ax1A,ax1B are the unit length slider axes as computed from bodyA and
338 // bodyB, we need to rotate both bodies along the axis u = (ax1 x ax2).
339 // if "theta" is the angle between ax1 and ax2, we need an angular velocity
340 // along u to cover angle erp*theta in one step :
341 // |angular_velocity| = angle/time = erp*theta / stepsize
342 // = (erp*fps) * theta
343 // angular_velocity = |angular_velocity| * (ax1 x ax2) / |ax1 x ax2|
344 // = (erp*fps) * theta * (ax1 x ax2) / sin(theta)
345 // ...as ax1 and ax2 are unit length. if theta is smallish,
346 // theta ~= sin(theta), so
347 // angular_velocity = (erp*fps) * (ax1 x ax2)
348 // ax1 x ax2 is in the plane space of ax1, so we project the angular
349 // velocity to p and q to find the right hand side.
350 // btScalar k = info->fps * info->erp * getSoftnessOrthoAng();
351 btScalar currERP = (m_flags & BT_SLIDER_FLAGS_ERP_ORTANG) ? m_softnessOrthoAng : m_softnessOrthoAng * info->erp;
352 btScalar k = info->fps * currERP;
353
354 btVector3 u = ax1A.cross(ax1B);
355 info->m_constraintError[0] = k * u.dot(p);
356 info->m_constraintError[s] = k * u.dot(q);
357 if(m_flags & BT_SLIDER_FLAGS_CFM_ORTANG)
358 {
359 info->cfm[0] = m_cfmOrthoAng;
360 info->cfm[s] = m_cfmOrthoAng;
361 }
362
363 int nrow = 1; // last filled row
364 int srow;
365 btScalar limit_err;
366 int limit;
367
368 // next two rows.
369 // we want: velA + wA x relA == velB + wB x relB ... but this would
370 // result in three equations, so we project along two orthos to the slider axis
371
372 btTransform bodyA_trans = transA;
373 btTransform bodyB_trans = transB;
374 nrow++;
375 int s2 = nrow * s;
376 nrow++;
377 int s3 = nrow * s;
378 btVector3 tmpA(0,0,0), tmpB(0,0,0), relA(0,0,0), relB(0,0,0), c(0,0,0);
379 if(m_useOffsetForConstraintFrame)
380 {
381 // get vector from bodyB to frameB in WCS
382 relB = trB.getOrigin() - bodyB_trans.getOrigin();
383 // get its projection to slider axis
384 btVector3 projB = ax1 * relB.dot(ax1);
385 // get vector directed from bodyB to slider axis (and orthogonal to it)
386 btVector3 orthoB = relB - projB;
387 // same for bodyA
388 relA = trA.getOrigin() - bodyA_trans.getOrigin();
389 btVector3 projA = ax1 * relA.dot(ax1);
390 btVector3 orthoA = relA - projA;
391 // get desired offset between frames A and B along slider axis
392 btScalar sliderOffs = m_linPos - m_depth[0];
393 // desired vector from projection of center of bodyA to projection of center of bodyB to slider axis
394 btVector3 totalDist = projA + ax1 * sliderOffs - projB;
395 // get offset vectors relA and relB
396 relA = orthoA + totalDist * factA;
397 relB = orthoB - totalDist * factB;
398 // now choose average ortho to slider axis
399 p = orthoB * factA + orthoA * factB;
400 btScalar len2 = p.length2();
401 if(len2 > SIMD_EPSILON)
402 {
403 p /= btSqrt(len2);
404 }
405 else
406 {
407 p = trA.getBasis().getColumn(1);
408 }
409 // make one more ortho
410 q = ax1.cross(p);
411 // fill two rows
412 tmpA = relA.cross(p);
413 tmpB = relB.cross(p);
414 for (i=0; i<3; i++) info->m_J1angularAxis[s2+i] = tmpA[i];
415 for (i=0; i<3; i++) info->m_J2angularAxis[s2+i] = -tmpB[i];
416 tmpA = relA.cross(q);
417 tmpB = relB.cross(q);
418 if(hasStaticBody && getSolveAngLimit())
419 { // to make constraint between static and dynamic objects more rigid
420 // remove wA (or wB) from equation if angular limit is hit
421 tmpB *= factB;
422 tmpA *= factA;
423 }
424 for (i=0; i<3; i++) info->m_J1angularAxis[s3+i] = tmpA[i];
425 for (i=0; i<3; i++) info->m_J2angularAxis[s3+i] = -tmpB[i];
426 for (i=0; i<3; i++) info->m_J1linearAxis[s2+i] = p[i];
427 for (i=0; i<3; i++) info->m_J1linearAxis[s3+i] = q[i];
428 for (i=0; i<3; i++) info->m_J2linearAxis[s2+i] = -p[i];
429 for (i=0; i<3; i++) info->m_J2linearAxis[s3+i] = -q[i];
430 }
431 else
432 { // old way - maybe incorrect if bodies are not on the slider axis
433 // see discussion "Bug in slider constraint" http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=4024&start=0
434 c = bodyB_trans.getOrigin() - bodyA_trans.getOrigin();
435 btVector3 tmp = c.cross(p);
436 for (i=0; i<3; i++) info->m_J1angularAxis[s2+i] = factA*tmp[i];
437 for (i=0; i<3; i++) info->m_J2angularAxis[s2+i] = factB*tmp[i];
438 tmp = c.cross(q);
439 for (i=0; i<3; i++) info->m_J1angularAxis[s3+i] = factA*tmp[i];
440 for (i=0; i<3; i++) info->m_J2angularAxis[s3+i] = factB*tmp[i];
441
442 for (i=0; i<3; i++) info->m_J1linearAxis[s2+i] = p[i];
443 for (i=0; i<3; i++) info->m_J1linearAxis[s3+i] = q[i];
444 for (i=0; i<3; i++) info->m_J2linearAxis[s2+i] = -p[i];
445 for (i=0; i<3; i++) info->m_J2linearAxis[s3+i] = -q[i];
446 }
447 // compute two elements of right hand side
448
449 // k = info->fps * info->erp * getSoftnessOrthoLin();
450 currERP = (m_flags & BT_SLIDER_FLAGS_ERP_ORTLIN) ? m_softnessOrthoLin : m_softnessOrthoLin * info->erp;
451 k = info->fps * currERP;
452
453 btScalar rhs = k * p.dot(ofs);
454 info->m_constraintError[s2] = rhs;
455 rhs = k * q.dot(ofs);
456 info->m_constraintError[s3] = rhs;
457 if(m_flags & BT_SLIDER_FLAGS_CFM_ORTLIN)
458 {
459 info->cfm[s2] = m_cfmOrthoLin;
460 info->cfm[s3] = m_cfmOrthoLin;
461 }
462
463
464 // check linear limits
465 limit_err = btScalar(0.0);
466 limit = 0;
467 if(getSolveLinLimit())
468 {
469 limit_err = getLinDepth() * signFact;
470 limit = (limit_err > btScalar(0.0)) ? 2 : 1;
471 }
472 bool powered = getPoweredLinMotor();
473 // if the slider has joint limits or motor, add in the extra row
474 if (limit || powered)
475 {
476 nrow++;
477 srow = nrow * info->rowskip;
478 info->m_J1linearAxis[srow+0] = ax1[0];
479 info->m_J1linearAxis[srow+1] = ax1[1];
480 info->m_J1linearAxis[srow+2] = ax1[2];
481 info->m_J2linearAxis[srow+0] = -ax1[0];
482 info->m_J2linearAxis[srow+1] = -ax1[1];
483 info->m_J2linearAxis[srow+2] = -ax1[2];
484 // linear torque decoupling step:
485 //
486 // we have to be careful that the linear constraint forces (+/- ax1) applied to the two bodies
487 // do not create a torque couple. in other words, the points that the
488 // constraint force is applied at must lie along the same ax1 axis.
489 // a torque couple will result in limited slider-jointed free
490 // bodies from gaining angular momentum.
491 if(m_useOffsetForConstraintFrame)
492 {
493 // this is needed only when bodyA and bodyB are both dynamic.
494 if(!hasStaticBody)
495 {
496 tmpA = relA.cross(ax1);
497 tmpB = relB.cross(ax1);
498 info->m_J1angularAxis[srow+0] = tmpA[0];
499 info->m_J1angularAxis[srow+1] = tmpA[1];
500 info->m_J1angularAxis[srow+2] = tmpA[2];
501 info->m_J2angularAxis[srow+0] = -tmpB[0];
502 info->m_J2angularAxis[srow+1] = -tmpB[1];
503 info->m_J2angularAxis[srow+2] = -tmpB[2];
504 }
505 }
506 else
507 { // The old way. May be incorrect if bodies are not on the slider axis
508 btVector3 ltd; // Linear Torque Decoupling vector (a torque)
509 ltd = c.cross(ax1);
510 info->m_J1angularAxis[srow+0] = factA*ltd[0];
511 info->m_J1angularAxis[srow+1] = factA*ltd[1];
512 info->m_J1angularAxis[srow+2] = factA*ltd[2];
513 info->m_J2angularAxis[srow+0] = factB*ltd[0];
514 info->m_J2angularAxis[srow+1] = factB*ltd[1];
515 info->m_J2angularAxis[srow+2] = factB*ltd[2];
516 }
517 // right-hand part
518 btScalar lostop = getLowerLinLimit();
519 btScalar histop = getUpperLinLimit();
520 if(limit && (lostop == histop))
521 { // the joint motor is ineffective
522 powered = false;
523 }
524 info->m_constraintError[srow] = 0.;
525 info->m_lowerLimit[srow] = 0.;
526 info->m_upperLimit[srow] = 0.;
527 currERP = (m_flags & BT_SLIDER_FLAGS_ERP_LIMLIN) ? m_softnessLimLin : info->erp;
528 if(powered)
529 {
530 if(m_flags & BT_SLIDER_FLAGS_CFM_DIRLIN)
531 {
532 info->cfm[srow] = m_cfmDirLin;
533 }
534 btScalar tag_vel = getTargetLinMotorVelocity();
535 btScalar mot_fact = getMotorFactor(m_linPos, m_lowerLinLimit, m_upperLinLimit, tag_vel, info->fps * currERP);
536 info->m_constraintError[srow] -= signFact * mot_fact * getTargetLinMotorVelocity();
537 info->m_lowerLimit[srow] += -getMaxLinMotorForce() / info->fps;
538 info->m_upperLimit[srow] += getMaxLinMotorForce() / info->fps;
539 }
540 if(limit)
541 {
542 k = info->fps * currERP;
543 info->m_constraintError[srow] += k * limit_err;
544 if(m_flags & BT_SLIDER_FLAGS_CFM_LIMLIN)
545 {
546 info->cfm[srow] = m_cfmLimLin;
547 }
548 if(lostop == histop)
549 { // limited low and high simultaneously
550 info->m_lowerLimit[srow] = -SIMD_INFINITY;
551 info->m_upperLimit[srow] = SIMD_INFINITY;
552 }
553 else if(limit == 1)
554 { // low limit
555 info->m_lowerLimit[srow] = -SIMD_INFINITY;
556 info->m_upperLimit[srow] = 0;
557 }
558 else
559 { // high limit
560 info->m_lowerLimit[srow] = 0;
561 info->m_upperLimit[srow] = SIMD_INFINITY;
562 }
563 // bounce (we'll use slider parameter abs(1.0 - m_dampingLimLin) for that)
564 btScalar bounce = btFabs(btScalar(1.0) - getDampingLimLin());
565 if(bounce > btScalar(0.0))
566 {
567 btScalar vel = linVelA.dot(ax1);
568 vel -= linVelB.dot(ax1);
569 vel *= signFact;
570 // only apply bounce if the velocity is incoming, and if the
571 // resulting c[] exceeds what we already have.
572 if(limit == 1)
573 { // low limit
574 if(vel < 0)
575 {
576 btScalar newc = -bounce * vel;
577 if (newc > info->m_constraintError[srow])
578 {
579 info->m_constraintError[srow] = newc;
580 }
581 }
582 }
583 else
584 { // high limit - all those computations are reversed
585 if(vel > 0)
586 {
587 btScalar newc = -bounce * vel;
588 if(newc < info->m_constraintError[srow])
589 {
590 info->m_constraintError[srow] = newc;
591 }
592 }
593 }
594 }
595 info->m_constraintError[srow] *= getSoftnessLimLin();
596 } // if(limit)
597 } // if linear limit
598 // check angular limits
599 limit_err = btScalar(0.0);
600 limit = 0;
601 if(getSolveAngLimit())
602 {
603 limit_err = getAngDepth();
604 limit = (limit_err > btScalar(0.0)) ? 1 : 2;
605 }
606 // if the slider has joint limits, add in the extra row
607 powered = getPoweredAngMotor();
608 if(limit || powered)
609 {
610 nrow++;
611 srow = nrow * info->rowskip;
612 info->m_J1angularAxis[srow+0] = ax1[0];
613 info->m_J1angularAxis[srow+1] = ax1[1];
614 info->m_J1angularAxis[srow+2] = ax1[2];
615
616 info->m_J2angularAxis[srow+0] = -ax1[0];
617 info->m_J2angularAxis[srow+1] = -ax1[1];
618 info->m_J2angularAxis[srow+2] = -ax1[2];
619
620 btScalar lostop = getLowerAngLimit();
621 btScalar histop = getUpperAngLimit();
622 if(limit && (lostop == histop))
623 { // the joint motor is ineffective
624 powered = false;
625 }
626 currERP = (m_flags & BT_SLIDER_FLAGS_ERP_LIMANG) ? m_softnessLimAng : info->erp;
627 if(powered)
628 {
629 if(m_flags & BT_SLIDER_FLAGS_CFM_DIRANG)
630 {
631 info->cfm[srow] = m_cfmDirAng;
632 }
633 btScalar mot_fact = getMotorFactor(m_angPos, m_lowerAngLimit, m_upperAngLimit, getTargetAngMotorVelocity(), info->fps * currERP);
634 info->m_constraintError[srow] = mot_fact * getTargetAngMotorVelocity();
635 info->m_lowerLimit[srow] = -getMaxAngMotorForce() / info->fps;
636 info->m_upperLimit[srow] = getMaxAngMotorForce() / info->fps;
637 }
638 if(limit)
639 {
640 k = info->fps * currERP;
641 info->m_constraintError[srow] += k * limit_err;
642 if(m_flags & BT_SLIDER_FLAGS_CFM_LIMANG)
643 {
644 info->cfm[srow] = m_cfmLimAng;
645 }
646 if(lostop == histop)
647 {
648 // limited low and high simultaneously
649 info->m_lowerLimit[srow] = -SIMD_INFINITY;
650 info->m_upperLimit[srow] = SIMD_INFINITY;
651 }
652 else if(limit == 1)
653 { // low limit
654 info->m_lowerLimit[srow] = 0;
655 info->m_upperLimit[srow] = SIMD_INFINITY;
656 }
657 else
658 { // high limit
659 info->m_lowerLimit[srow] = -SIMD_INFINITY;
660 info->m_upperLimit[srow] = 0;
661 }
662 // bounce (we'll use slider parameter abs(1.0 - m_dampingLimAng) for that)
663 btScalar bounce = btFabs(btScalar(1.0) - getDampingLimAng());
664 if(bounce > btScalar(0.0))
665 {
666 btScalar vel = m_rbA.getAngularVelocity().dot(ax1);
667 vel -= m_rbB.getAngularVelocity().dot(ax1);
668 // only apply bounce if the velocity is incoming, and if the
669 // resulting c[] exceeds what we already have.
670 if(limit == 1)
671 { // low limit
672 if(vel < 0)
673 {
674 btScalar newc = -bounce * vel;
675 if(newc > info->m_constraintError[srow])
676 {
677 info->m_constraintError[srow] = newc;
678 }
679 }
680 }
681 else
682 { // high limit - all those computations are reversed
683 if(vel > 0)
684 {
685 btScalar newc = -bounce * vel;
686 if(newc < info->m_constraintError[srow])
687 {
688 info->m_constraintError[srow] = newc;
689 }
690 }
691 }
692 }
693 info->m_constraintError[srow] *= getSoftnessLimAng();
694 } // if(limit)
695 } // if angular limit or powered
696 }
697
698
701 void btSliderConstraint::setParam(int num, btScalar value, int axis)
702 {
703 switch(num)
704 {
705 case BT_CONSTRAINT_STOP_ERP :
706 if(axis < 1)
707 {
708 m_softnessLimLin = value;
709 m_flags |= BT_SLIDER_FLAGS_ERP_LIMLIN;
710 }
711 else if(axis < 3)
712 {
713 m_softnessOrthoLin = value;
714 m_flags |= BT_SLIDER_FLAGS_ERP_ORTLIN;
715 }
716 else if(axis == 3)
717 {
718 m_softnessLimAng = value;
719 m_flags |= BT_SLIDER_FLAGS_ERP_LIMANG;
720 }
721 else if(axis < 6)
722 {
723 m_softnessOrthoAng = value;
724 m_flags |= BT_SLIDER_FLAGS_ERP_ORTANG;
725 }
726 else
727 {
728 btAssertConstrParams(0);
729 }
730 break;
731 case BT_CONSTRAINT_CFM :
732 if(axis < 1)
733 {
734 m_cfmDirLin = value;
735 m_flags |= BT_SLIDER_FLAGS_CFM_DIRLIN;
736 }
737 else if(axis == 3)
738 {
739 m_cfmDirAng = value;
740 m_flags |= BT_SLIDER_FLAGS_CFM_DIRANG;
741 }
742 else
743 {
744 btAssertConstrParams(0);
745 }
746 break;
747 case BT_CONSTRAINT_STOP_CFM :
748 if(axis < 1)
749 {
750 m_cfmLimLin = value;
751 m_flags |= BT_SLIDER_FLAGS_CFM_LIMLIN;
752 }
753 else if(axis < 3)
754 {
755 m_cfmOrthoLin = value;
756 m_flags |= BT_SLIDER_FLAGS_CFM_ORTLIN;
757 }
758 else if(axis == 3)
759 {
760 m_cfmLimAng = value;
761 m_flags |= BT_SLIDER_FLAGS_CFM_LIMANG;
762 }
763 else if(axis < 6)
764 {
765 m_cfmOrthoAng = value;
766 m_flags |= BT_SLIDER_FLAGS_CFM_ORTANG;
767 }
768 else
769 {
770 btAssertConstrParams(0);
771 }
772 break;
773 }
774 }
775
777 btScalar btSliderConstraint::getParam(int num, int axis) const
778 {
779 btScalar retVal(SIMD_INFINITY);
780 switch(num)
781 {
782 case BT_CONSTRAINT_STOP_ERP :
783 if(axis < 1)
784 {
785 btAssertConstrParams(m_flags & BT_SLIDER_FLAGS_ERP_LIMLIN);
786 retVal = m_softnessLimLin;
787 }
788 else if(axis < 3)
789 {
790 btAssertConstrParams(m_flags & BT_SLIDER_FLAGS_ERP_ORTLIN);
791 retVal = m_softnessOrthoLin;
792 }
793 else if(axis == 3)
794 {
795 btAssertConstrParams(m_flags & BT_SLIDER_FLAGS_ERP_LIMANG);
796 retVal = m_softnessLimAng;
797 }
798 else if(axis < 6)
799 {
800 btAssertConstrParams(m_flags & BT_SLIDER_FLAGS_ERP_ORTANG);
801 retVal = m_softnessOrthoAng;
802 }
803 else
804 {
805 btAssertConstrParams(0);
806 }
807 break;
808 case BT_CONSTRAINT_CFM :
809 if(axis < 1)
810 {
811 btAssertConstrParams(m_flags & BT_SLIDER_FLAGS_CFM_DIRLIN);
812 retVal = m_cfmDirLin;
813 }
814 else if(axis == 3)
815 {
816 btAssertConstrParams(m_flags & BT_SLIDER_FLAGS_CFM_DIRANG);
817 retVal = m_cfmDirAng;
818 }
819 else
820 {
821 btAssertConstrParams(0);
822 }
823 break;
824 case BT_CONSTRAINT_STOP_CFM :
825 if(axis < 1)
826 {
827 btAssertConstrParams(m_flags & BT_SLIDER_FLAGS_CFM_LIMLIN);
828 retVal = m_cfmLimLin;
829 }
830 else if(axis < 3)
831 {
832 btAssertConstrParams(m_flags & BT_SLIDER_FLAGS_CFM_ORTLIN);
833 retVal = m_cfmOrthoLin;
834 }
835 else if(axis == 3)
836 {
837 btAssertConstrParams(m_flags & BT_SLIDER_FLAGS_CFM_LIMANG);
838 retVal = m_cfmLimAng;
839 }
840 else if(axis < 6)
841 {
842 btAssertConstrParams(m_flags & BT_SLIDER_FLAGS_CFM_ORTANG);
843 retVal = m_cfmOrthoAng;
844 }
845 else
846 {
847 btAssertConstrParams(0);
848 }
849 break;
850 }
851 return retVal;
852 }
853
854
855
btTypedConstraint::btConstraintInfo2::m_constraintError
btScalar * m_constraintError
Definition: btTypedConstraint.h:143
BT_SLIDER_FLAGS_CFM_LIMANG
Definition: btSliderConstraint.h:66
btSliderConstraint::calculateTransforms
void calculateTransforms(const btTransform &transA, const btTransform &transB)
Definition: btSliderConstraint.cpp:159
SLIDER_CONSTRAINT_DEF_RESTITUTION
#define SLIDER_CONSTRAINT_DEF_RESTITUTION
Definition: btSliderConstraint.h:50
SIMD_EPSILON
#define SIMD_EPSILON
Definition: btScalar.h:521
btSliderConstraint::m_dampingOrthoAng
btScalar m_dampingOrthoAng
Definition: btSliderConstraint.h:120
btTransformUtil.h
btSliderConstraint::getAncorInB
btVector3 getAncorInB()
Definition: btSliderConstraint.cpp:260
BT_SLIDER_FLAGS_ERP_ORTANG
Definition: btSliderConstraint.h:63
btSliderConstraint::getMaxAngMotorForce
btScalar getMaxAngMotorForce()
Definition: btSliderConstraint.h:248
btTypedConstraint::btConstraintInfo2::m_J2angularAxis
btScalar * m_J2angularAxis
Definition: btTypedConstraint.h:135
BT_SLIDER_FLAGS_ERP_LIMANG
Definition: btSliderConstraint.h:67
btSliderConstraint::m_cfmOrthoLin
btScalar m_cfmOrthoLin
Definition: btSliderConstraint.h:116
btTypedConstraint::btConstraintInfo2::m_upperLimit
btScalar * m_upperLimit
Definition: btTypedConstraint.h:146
btRigidBody::getAngularVelocity
const btVector3 & getAngularVelocity() const
Definition: btRigidBody.h:365
btSliderConstraint::getParam
virtual btScalar getParam(int num, int axis=-1) const
return the local value of parameter
Definition: btSliderConstraint.cpp:777
btSliderConstraint::m_dampingDirLin
btScalar m_dampingDirLin
Definition: btSliderConstraint.h:95
btTypedConstraint::m_rbA
btRigidBody & m_rbA
Definition: btTypedConstraint.h:102
btSliderConstraint::m_dampingOrthoLin
btScalar m_dampingOrthoLin
Definition: btSliderConstraint.h:115
btTypedConstraint::btConstraintInfo2
Definition: btTypedConstraint.h:126
btSliderConstraint::getCalculatedTransformA
const btTransform & getCalculatedTransformA() const
Definition: btSliderConstraint.h:186
BT_SLIDER_FLAGS_CFM_DIRLIN
Definition: btSliderConstraint.h:56
btSliderConstraint::getCalculatedTransformB
const btTransform & getCalculatedTransformB() const
Definition: btSliderConstraint.h:187
btSliderConstraint::m_cfmDirLin
btScalar m_cfmDirLin
Definition: btSliderConstraint.h:96
USE_OFFSET_FOR_CONSTANT_FRAME
#define USE_OFFSET_FOR_CONSTANT_FRAME
Definition: btSliderConstraint.cpp:28
btSliderConstraint::getInfo2NonVirtual
void getInfo2NonVirtual(btConstraintInfo2 *info, const btTransform &transA, const btTransform &transB, const btVector3 &linVelA, const btVector3 &linVelB, btScalar rbAinvMass, btScalar rbBinvMass)
Definition: btSliderConstraint.cpp:268
btSliderConstraint::getInfo2
virtual void getInfo2(btConstraintInfo2 *info)
internal method used by the constraint solver, don&#39;t use them directly
Definition: btSliderConstraint.cpp:148
btRigidBody::getCenterOfMassTransform
const btTransform & getCenterOfMassTransform() const
Definition: btRigidBody.h:359
btSliderConstraint::m_restitutionOrthoAng
btScalar m_restitutionOrthoAng
Definition: btSliderConstraint.h:119
btVector3::length2
btScalar length2() const
Return the length of the vector squared.
Definition: btVector3.h:257
btSliderConstraint::m_frameInA
btTransform m_frameInA
Definition: btSliderConstraint.h:77
btSliderConstraint::m_accumulatedAngMotorImpulse
btScalar m_accumulatedAngMotorImpulse
Definition: btSliderConstraint.h:161
btPlaneSpace1
void btPlaneSpace1(const T &n, T &p, T &q)
Definition: btVector3.h:1283
btSliderConstraint::m_dampingDirAng
btScalar m_dampingDirAng
Definition: btSliderConstraint.h:100
btSqrt
btScalar btSqrt(btScalar y)
Definition: btScalar.h:444
btTypedConstraint::btConstraintInfo1::m_numConstraintRows
int m_numConstraintRows
Definition: btTypedConstraint.h:121
btAssert
#define btAssert(x)
Definition: btScalar.h:131
btSliderConstraint::m_accumulatedLinMotorImpulse
btScalar m_accumulatedLinMotorImpulse
Definition: btSliderConstraint.h:156
btTypedConstraint::btConstraintInfo2::cfm
btScalar * cfm
Definition: btTypedConstraint.h:143
btSliderConstraint::getSolveAngLimit
bool getSolveAngLimit()
Definition: btSliderConstraint.h:258
BT_SLIDER_FLAGS_CFM_DIRANG
Definition: btSliderConstraint.h:58
btSliderConstraint::getLowerLinLimit
btScalar getLowerLinLimit()
Definition: btSliderConstraint.h:192
btSliderConstraint::m_calculatedTransformB
btTransform m_calculatedTransformB
Definition: btSliderConstraint.h:136
btSliderConstraint::getPoweredLinMotor
bool getPoweredLinMotor()
Definition: btSliderConstraint.h:238
btSliderConstraint::getLinDepth
btScalar getLinDepth()
Definition: btSliderConstraint.h:257
btSliderConstraint::m_lowerLinLimit
btScalar m_lowerLinLimit
Definition: btSliderConstraint.h:82
btSliderConstraint::m_frameInB
btTransform m_frameInB
Definition: btSliderConstraint.h:78
btTypedConstraint::btConstraintInfo2::m_J1angularAxis
btScalar * m_J1angularAxis
Definition: btTypedConstraint.h:135
BT_CONSTRAINT_CFM
Definition: btTypedConstraint.h:56
btSliderConstraint::m_targetLinMotorVelocity
btScalar m_targetLinMotorVelocity
Definition: btSliderConstraint.h:154
btSliderConstraint::m_depth
btVector3 m_depth
Definition: btSliderConstraint.h:143
btRigidBody.h
btSliderConstraint::getPoweredAngMotor
bool getPoweredAngMotor()
Definition: btSliderConstraint.h:244
btVector3::normalize
btVector3 & normalize()
Normalize this vector x^2 + y^2 + z^2 = 1.
Definition: btVector3.h:309
btSliderConstraint::m_upperLinLimit
btScalar m_upperLinLimit
Definition: btSliderConstraint.h:83
BT_CONSTRAINT_STOP_ERP
Definition: btTypedConstraint.h:55
btSliderConstraint::btSliderConstraint
btSliderConstraint(btRigidBody &rbA, btRigidBody &rbB, const btTransform &frameInA, const btTransform &frameInB, bool useLinearReferenceFrameA)
Definition: btSliderConstraint.cpp:83
btSliderConstraint::getMaxLinMotorForce
btScalar getMaxLinMotorForce()
Definition: btSliderConstraint.h:242
btMatrix3x3::getColumn
btVector3 getColumn(int i) const
Get a column of the matrix as a vector.
Definition: btMatrix3x3.h:134
SIMD_INFINITY
#define SIMD_INFINITY
Definition: btScalar.h:522
btSliderConstraint::getAngDepth
btScalar getAngDepth()
Definition: btSliderConstraint.h:259
BT_SLIDER_FLAGS_ERP_LIMLIN
Definition: btSliderConstraint.h:65
btSliderConstraint::m_projPivotInW
btVector3 m_projPivotInW
Definition: btSliderConstraint.h:141
BT_CONSTRAINT_STOP_CFM
Definition: btTypedConstraint.h:57
btSliderConstraint::m_restitutionLimLin
btScalar m_restitutionLimLin
Definition: btSliderConstraint.h:104
btSliderConstraint::getUpperAngLimit
btScalar getUpperAngLimit()
Definition: btSliderConstraint.h:198
btTypedConstraint::btConstraintInfo2::m_J1linearAxis
btScalar * m_J1linearAxis
Definition: btTypedConstraint.h:135
btSliderConstraint::m_solveLinLim
bool m_solveLinLim
Definition: btSliderConstraint.h:124
btTransform::getOrigin
btVector3 & getOrigin()
Return the origin vector translation.
Definition: btTransform.h:117
btSliderConstraint::m_softnessLimLin
btScalar m_softnessLimLin
Definition: btSliderConstraint.h:103
btSliderConstraint::m_dampingLimLin
btScalar m_dampingLimLin
Definition: btSliderConstraint.h:105
btRigidBody::getLinearVelocity
const btVector3 & getLinearVelocity() const
Definition: btRigidBody.h:362
btSliderConstraint::m_restitutionLimAng
btScalar m_restitutionLimAng
Definition: btSliderConstraint.h:109
btSliderConstraint::m_dampingLimAng
btScalar m_dampingLimAng
Definition: btSliderConstraint.h:110
btRigidBody::getInvMass
btScalar getInvMass() const
Definition: btRigidBody.h:273
btTypedConstraint::btConstraintInfo2::erp
btScalar erp
Definition: btTypedConstraint.h:129
btVector3::cross
btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector.
Definition: btVector3.h:389
btVector3::dot
btScalar dot(const btVector3 &v) const
Return the dot product.
Definition: btVector3.h:235
btSliderConstraint::m_restitutionDirAng
btScalar m_restitutionDirAng
Definition: btSliderConstraint.h:99
btAtan2
btScalar btAtan2(btScalar x, btScalar y)
Definition: btScalar.h:496
SLIDER_CONSTRAINT_DEF_CFM
#define SLIDER_CONSTRAINT_DEF_CFM
Definition: btSliderConstraint.h:51
btSliderConstraint::getDampingLimAng
btScalar getDampingLimAng()
Definition: btSliderConstraint.h:212
btSliderConstraint::m_softnessDirLin
btScalar m_softnessDirLin
Definition: btSliderConstraint.h:93
btTypedConstraint::btConstraintInfo2::m_lowerLimit
btScalar * m_lowerLimit
Definition: btTypedConstraint.h:146
btTransform::getBasis
btMatrix3x3 & getBasis()
Return the basis matrix for the rotation.
Definition: btTransform.h:112
btRigidBody
The btRigidBody is the main class for rigid body objects.
Definition: btRigidBody.h:62
btSliderConstraint::m_realPivotBInW
btVector3 m_realPivotBInW
Definition: btSliderConstraint.h:140
BT_SLIDER_FLAGS_CFM_ORTANG
Definition: btSliderConstraint.h:62
btSliderConstraint::m_softnessOrthoLin
btScalar m_softnessOrthoLin
Definition: btSliderConstraint.h:113
SLIDER_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:42
btSliderConstraint::m_targetAngMotorVelocity
btScalar m_targetAngMotorVelocity
Definition: btSliderConstraint.h:159
btSliderConstraint::getInfo1
virtual void getInfo1(btConstraintInfo1 *info)
internal method used by the constraint solver, don&#39;t use them directly
Definition: btSliderConstraint.cpp:113
btSliderConstraint::m_useOffsetForConstraintFrame
bool m_useOffsetForConstraintFrame
Definition: btSliderConstraint.h:76
btSliderConstraint::getUpperLinLimit
btScalar getUpperLinLimit()
Definition: btSliderConstraint.h:194
btSliderConstraint::getTargetLinMotorVelocity
btScalar getTargetLinMotorVelocity()
Definition: btSliderConstraint.h:240
SLIDER_CONSTRAINT_DEF_SOFTNESS
#define SLIDER_CONSTRAINT_DEF_SOFTNESS
Definition: btSliderConstraint.h:48
btSliderConstraint::getInfo1NonVirtual
void getInfo1NonVirtual(btConstraintInfo1 *info)
Definition: btSliderConstraint.cpp:141
btSliderConstraint::m_upperAngLimit
btScalar m_upperAngLimit
Definition: btSliderConstraint.h:86
btSliderConstraint::m_cfmLimAng
btScalar m_cfmLimAng
Definition: btSliderConstraint.h:111
btAdjustAngleToLimits
btScalar btAdjustAngleToLimits(btScalar angleInRadians, btScalar angleLowerLimitInRadians, btScalar angleUpperLimitInRadians)
Definition: btTypedConstraint.h:341
btSliderConstraint::m_cfmDirAng
btScalar m_cfmDirAng
Definition: btSliderConstraint.h:101
btVector3
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:83
BT_SLIDER_FLAGS_ERP_ORTLIN
Definition: btSliderConstraint.h:61
btTypedConstraint::btConstraintInfo2::rowskip
int rowskip
Definition: btTypedConstraint.h:138
btSliderConstraint::getSolveLinLimit
bool getSolveLinLimit()
Definition: btSliderConstraint.h:256
btTypedConstraint::getFixedBody
static btRigidBody & getFixedBody()
Definition: btTypedConstraint.cpp:148
btTransform
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition: btTransform.h:34
btSliderConstraint::m_flags
int m_flags
Definition: btSliderConstraint.h:127
btTypedConstraint::m_rbB
btRigidBody & m_rbB
Definition: btTypedConstraint.h:103
btSliderConstraint::m_useLinearReferenceFrameA
bool m_useLinearReferenceFrameA
Definition: btSliderConstraint.h:80
BT_SLIDER_FLAGS_CFM_ORTLIN
Definition: btSliderConstraint.h:60
btSliderConstraint::getTargetAngMotorVelocity
btScalar getTargetAngMotorVelocity()
Definition: btSliderConstraint.h:246
btSliderConstraint::testLinLimits
void testLinLimits()
Definition: btSliderConstraint.cpp:195
btSliderConstraint::m_angDepth
btScalar m_angDepth
Definition: btSliderConstraint.h:150
btTypedConstraint::btConstraintInfo2::m_J2linearAxis
btScalar * m_J2linearAxis
Definition: btTypedConstraint.h:135
btSliderConstraint::m_cfmOrthoAng
btScalar m_cfmOrthoAng
Definition: btSliderConstraint.h:121
btSliderConstraint::m_calculatedTransformA
btTransform m_calculatedTransformA
Definition: btSliderConstraint.h:135
btTypedConstraint
TypedConstraint is the baseclass for Bullet constraints and vehicles.
Definition: btTypedConstraint.h:78
btSliderConstraint::m_cfmLimLin
btScalar m_cfmLimLin
Definition: btSliderConstraint.h:106
btSliderConstraint::getSoftnessLimLin
btScalar getSoftnessLimLin()
Definition: btSliderConstraint.h:207
btSliderConstraint::m_poweredLinMotor
bool m_poweredLinMotor
Definition: btSliderConstraint.h:153
btTypedConstraint::getMotorFactor
btScalar getMotorFactor(btScalar pos, btScalar lowLim, btScalar uppLim, btScalar vel, btScalar timeFact)
internal method used by the constraint solver, don&#39;t use them directly
Definition: btTypedConstraint.cpp:60
btSliderConstraint.h
btTypedConstraint::btConstraintInfo1::nub
int nub
Definition: btTypedConstraint.h:121
btSliderConstraint::m_realPivotAInW
btVector3 m_realPivotAInW
Definition: btSliderConstraint.h:139
btSliderConstraint::m_poweredAngMotor
bool m_poweredAngMotor
Definition: btSliderConstraint.h:158
btSliderConstraint::m_softnessDirAng
btScalar m_softnessDirAng
Definition: btSliderConstraint.h:98
btSliderConstraint::m_linPos
btScalar m_linPos
Definition: btSliderConstraint.h:147
btTypedConstraint::btConstraintInfo2::fps
btScalar fps
Definition: btTypedConstraint.h:129
btSliderConstraint::initParams
void initParams()
Definition: btSliderConstraint.cpp:30
btSliderConstraint::m_useSolveConstraintObsolete
bool m_useSolveConstraintObsolete
for backwards compatibility during the transition to &#39;getInfo/getInfo2&#39;
Definition: btSliderConstraint.h:75
btSliderConstraint::m_lowerAngLimit
btScalar m_lowerAngLimit
Definition: btSliderConstraint.h:85
btSliderConstraint::m_maxLinMotorForce
btScalar m_maxLinMotorForce
Definition: btSliderConstraint.h:155
btSliderConstraint::m_sliderAxis
btVector3 m_sliderAxis
Definition: btSliderConstraint.h:138
btSliderConstraint::getLowerAngLimit
btScalar getLowerAngLimit()
Definition: btSliderConstraint.h:196
btSliderConstraint::getAncorInA
btVector3 getAncorInA()
Definition: btSliderConstraint.cpp:250
btSliderConstraint::m_angPos
btScalar m_angPos
Definition: btSliderConstraint.h:148
btSliderConstraint::m_restitutionDirLin
btScalar m_restitutionDirLin
Definition: btSliderConstraint.h:94
btSliderConstraint::m_maxAngMotorForce
btScalar m_maxAngMotorForce
Definition: btSliderConstraint.h:160
btSliderConstraint::m_solveAngLim
bool m_solveAngLim
Definition: btSliderConstraint.h:125
BT_SLIDER_FLAGS_CFM_LIMLIN
Definition: btSliderConstraint.h:64
btAssertConstrParams
#define btAssertConstrParams(_par)
Definition: btTypedConstraint.h:61
btTypedConstraint::btConstraintInfo1
Definition: btTypedConstraint.h:120
btSliderConstraint::m_softnessLimAng
btScalar m_softnessLimAng
Definition: btSliderConstraint.h:108
btSliderConstraint::getDampingLimLin
btScalar getDampingLimLin()
Definition: btSliderConstraint.h:209
btSliderConstraint::m_restitutionOrthoLin
btScalar m_restitutionOrthoLin
Definition: btSliderConstraint.h:114
btSliderConstraint::m_softnessOrthoAng
btScalar m_softnessOrthoAng
Definition: btSliderConstraint.h:118
btTransform::inverse
btTransform inverse() const
Return the inverse of this transform.
Definition: btTransform.h:188
btSliderConstraint::getSoftnessLimAng
btScalar getSoftnessLimAng()
Definition: btSliderConstraint.h:210
SLIDER_CONSTRAINT_DEF_DAMPING
#define SLIDER_CONSTRAINT_DEF_DAMPING
Definition: btSliderConstraint.h:49
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:292
btSliderConstraint::m_delta
btVector3 m_delta
Definition: btSliderConstraint.h:142
btSliderConstraint::setParam
virtual void setParam(int num, btScalar value, int axis=-1)
override the default global value of a parameter (such as ERP or CFM), optionally provide the axis (0...
Definition: btSliderConstraint.cpp:701
btSliderConstraint::testAngLimits
void testAngLimits()
Definition: btSliderConstraint.cpp:224
btFabs
btScalar btFabs(btScalar x)
Definition: btScalar.h:475