Bullet Collision Detection & Physics Library
btGeneric6DofSpring2Constraint.h
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 2014 May: btGeneric6DofSpring2Constraint is created from the original (2.82.2712) btGeneric6DofConstraint by Gabor Puhr and Tamas Umenhoffer
18 Pros:
19 - Much more accurate and stable in a lot of situation. (Especially when a sleeping chain of RBs connected with 6dof2 is pulled)
20 - Stable and accurate spring with minimal energy loss that works with all of the solvers. (latter is not true for the original 6dof spring)
21 - Servo motor functionality
22 - Much more accurate bouncing. 0 really means zero bouncing (not true for the original 6odf) and there is only a minimal energy loss when the value is 1 (because of the solvers' precision)
23 - Rotation order for the Euler system can be set. (One axis' freedom is still limited to pi/2)
24 
25 Cons:
26 - It is slower than the original 6dof. There is no exact ratio, but half speed is a good estimation.
27 - At bouncing the correct velocity is calculated, but not the correct position. (it is because of the solver can correct position or velocity, but not both.)
28 */
29 
32 
33 /*
34 2007-09-09
35 btGeneric6DofConstraint Refactored by Francisco Le?n
36 email: projectileman@yahoo.com
37 http://gimpact.sf.net
38 */
39 
40 
41 #ifndef BT_GENERIC_6DOF_CONSTRAINT2_H
42 #define BT_GENERIC_6DOF_CONSTRAINT2_H
43 
44 #include "LinearMath/btVector3.h"
45 #include "btJacobianEntry.h"
46 #include "btTypedConstraint.h"
47 
48 class btRigidBody;
49 
50 
51 #ifdef BT_USE_DOUBLE_PRECISION
52 #define btGeneric6DofSpring2ConstraintData2 btGeneric6DofSpring2ConstraintDoubleData2
53 #define btGeneric6DofSpring2ConstraintDataName "btGeneric6DofSpring2ConstraintDoubleData2"
54 #else
55 #define btGeneric6DofSpring2ConstraintData2 btGeneric6DofSpring2ConstraintData
56 #define btGeneric6DofSpring2ConstraintDataName "btGeneric6DofSpring2ConstraintData"
57 #endif //BT_USE_DOUBLE_PRECISION
58 
60 {
61  RO_XYZ=0,
67 };
68 
70 {
71 public:
72 // upper < lower means free
73 // upper == lower means locked
74 // upper > lower means limited
91 
96 
98  {
99  m_loLimit = 1.0f;
100  m_hiLimit = -1.0f;
101  m_bounce = 0.0f;
102  m_stopERP = 0.2f;
103  m_stopCFM = 0.f;
104  m_motorERP = 0.9f;
105  m_motorCFM = 0.f;
106  m_enableMotor = false;
107  m_targetVelocity = 0;
108  m_maxMotorForce = 0.1f;
109  m_servoMotor = false;
110  m_servoTarget = 0;
111  m_enableSpring = false;
112  m_springStiffness = 0;
113  m_springDamping = 0;
114  m_equilibriumPoint = 0;
115 
116  m_currentLimitError = 0;
117  m_currentLimitErrorHi = 0;
118  m_currentPosition = 0;
119  m_currentLimit = 0;
120  }
121 
123  {
124  m_loLimit = limot.m_loLimit;
125  m_hiLimit = limot.m_hiLimit;
126  m_bounce = limot.m_bounce;
127  m_stopERP = limot.m_stopERP;
128  m_stopCFM = limot.m_stopCFM;
129  m_motorERP = limot.m_motorERP;
130  m_motorCFM = limot.m_motorCFM;
131  m_enableMotor = limot.m_enableMotor;
132  m_targetVelocity = limot.m_targetVelocity;
133  m_maxMotorForce = limot.m_maxMotorForce;
134  m_servoMotor = limot.m_servoMotor;
135  m_servoTarget = limot.m_servoTarget;
136  m_enableSpring = limot.m_enableSpring;
137  m_springStiffness = limot.m_springStiffness;
138  m_springDamping = limot.m_springDamping;
139  m_equilibriumPoint = limot.m_equilibriumPoint;
140 
141  m_currentLimitError = limot.m_currentLimitError;
142  m_currentLimitErrorHi = limot.m_currentLimitErrorHi;
143  m_currentPosition = limot.m_currentPosition;
144  m_currentLimit = limot.m_currentLimit;
145  }
146 
147 
148  bool isLimited()
149  {
150  if(m_loLimit > m_hiLimit) return false;
151  return true;
152  }
153 
154  void testLimitValue(btScalar test_value);
155 };
156 
157 
158 
160 {
161 public:
162 // upper < lower means free
163 // upper == lower means locked
164 // upper > lower means limited
172  bool m_enableMotor[3];
173  bool m_servoMotor[3];
174  bool m_enableSpring[3];
181 
186 
188  {
189  m_lowerLimit .setValue(0.f , 0.f , 0.f );
190  m_upperLimit .setValue(0.f , 0.f , 0.f );
191  m_bounce .setValue(0.f , 0.f , 0.f );
192  m_stopERP .setValue(0.2f, 0.2f, 0.2f);
193  m_stopCFM .setValue(0.f , 0.f , 0.f );
194  m_motorERP .setValue(0.9f, 0.9f, 0.9f);
195  m_motorCFM .setValue(0.f , 0.f , 0.f );
196 
197  m_currentLimitError .setValue(0.f , 0.f , 0.f );
198  m_currentLimitErrorHi.setValue(0.f , 0.f , 0.f );
199  m_currentLinearDiff .setValue(0.f , 0.f , 0.f );
200 
201  for(int i=0; i < 3; i++)
202  {
203  m_enableMotor[i] = false;
204  m_servoMotor[i] = false;
205  m_enableSpring[i] = false;
206  m_servoTarget[i] = btScalar(0.f);
207  m_springStiffness[i] = btScalar(0.f);
208  m_springDamping[i] = btScalar(0.f);
209  m_equilibriumPoint[i] = btScalar(0.f);
210  m_targetVelocity[i] = btScalar(0.f);
211  m_maxMotorForce[i] = btScalar(0.f);
212 
213  m_currentLimit[i] = 0;
214  }
215  }
216 
218  {
219  m_lowerLimit = other.m_lowerLimit;
220  m_upperLimit = other.m_upperLimit;
221  m_bounce = other.m_bounce;
222  m_stopERP = other.m_stopERP;
223  m_stopCFM = other.m_stopCFM;
224  m_motorERP = other.m_motorERP;
225  m_motorCFM = other.m_motorCFM;
226 
227  m_currentLimitError = other.m_currentLimitError;
228  m_currentLimitErrorHi = other.m_currentLimitErrorHi;
229  m_currentLinearDiff = other.m_currentLinearDiff;
230 
231  for(int i=0; i < 3; i++)
232  {
233  m_enableMotor[i] = other.m_enableMotor[i];
234  m_servoMotor[i] = other.m_servoMotor[i];
235  m_enableSpring[i] = other.m_enableSpring[i];
236  m_servoTarget[i] = other.m_servoTarget[i];
237  m_springStiffness[i] = other.m_springStiffness[i];
238  m_springDamping[i] = other.m_springDamping[i];
239  m_equilibriumPoint[i] = other.m_equilibriumPoint[i];
240  m_targetVelocity[i] = other.m_targetVelocity[i];
241  m_maxMotorForce[i] = other.m_maxMotorForce[i];
242 
243  m_currentLimit[i] = other.m_currentLimit[i];
244  }
245  }
246 
247  inline bool isLimited(int limitIndex)
248  {
249  return (m_upperLimit[limitIndex] >= m_lowerLimit[limitIndex]);
250  }
251 
252  void testLimitValue(int limitIndex, btScalar test_value);
253 };
254 
256 {
261 };
262 #define BT_6DOF_FLAGS_AXIS_SHIFT2 4 // bits per axis
263 
264 
266 {
267 protected:
268 
271 
272  btJacobianEntry m_jacLinear[3];
273  btJacobianEntry m_jacAng[3];
274 
276  btRotationalLimitMotor2 m_angularLimits[3];
277 
279 
280 protected:
281 
285  btVector3 m_calculatedAxis[3];
290  int m_flags;
291 
293  {
294  btAssert(0);
295  return *this;
296  }
297 
298  int setAngularLimits(btConstraintInfo2 *info, int row_offset,const btTransform& transA,const btTransform& transB,const btVector3& linVelA,const btVector3& linVelB,const btVector3& angVelA,const btVector3& angVelB);
299  int setLinearLimits(btConstraintInfo2 *info, int row, const btTransform& transA,const btTransform& transB,const btVector3& linVelA,const btVector3& linVelB,const btVector3& angVelA,const btVector3& angVelB);
300 
301  void calculateLinearInfo();
302  void calculateAngleInfo();
303  void testAngularLimitMotor(int axis_index);
304 
305  void calculateJacobi(btRotationalLimitMotor2* limot, const btTransform& transA,const btTransform& transB, btConstraintInfo2* info, int srow, btVector3& ax1, int rotational, int rotAllowed);
306  int get_limit_motor_info2(btRotationalLimitMotor2* limot,
307  const btTransform& transA,const btTransform& transB,const btVector3& linVelA,const btVector3& linVelB,const btVector3& angVelA,const btVector3& angVelB,
308  btConstraintInfo2* info, int row, btVector3& ax1, int rotational, int rotAllowed = false);
309 
310  static btScalar btGetMatrixElem(const btMatrix3x3& mat, int index);
311  static bool matrixToEulerXYZ(const btMatrix3x3& mat,btVector3& xyz);
312  static bool matrixToEulerXZY(const btMatrix3x3& mat,btVector3& xyz);
313  static bool matrixToEulerYXZ(const btMatrix3x3& mat,btVector3& xyz);
314  static bool matrixToEulerYZX(const btMatrix3x3& mat,btVector3& xyz);
315  static bool matrixToEulerZXY(const btMatrix3x3& mat,btVector3& xyz);
316  static bool matrixToEulerZYX(const btMatrix3x3& mat,btVector3& xyz);
317 
318 public:
319 
321 
322  btGeneric6DofSpring2Constraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB, RotateOrder rotOrder = RO_XYZ);
323  btGeneric6DofSpring2Constraint(btRigidBody& rbB, const btTransform& frameInB, RotateOrder rotOrder = RO_XYZ);
324 
325  virtual void buildJacobian() {}
326  virtual void getInfo1 (btConstraintInfo1* info);
327  virtual void getInfo2 (btConstraintInfo2* info);
328  virtual int calculateSerializeBufferSize() const;
329  virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
330 
331  btRotationalLimitMotor2* getRotationalLimitMotor(int index) { return &m_angularLimits[index]; }
333 
334  // Calculates the global transform for the joint offset for body A an B, and also calculates the angle differences between the bodies.
335  void calculateTransforms(const btTransform& transA,const btTransform& transB);
336  void calculateTransforms();
337 
338  // Gets the global transform of the offset for body A
339  const btTransform & getCalculatedTransformA() const { return m_calculatedTransformA; }
340  // Gets the global transform of the offset for body B
341  const btTransform & getCalculatedTransformB() const { return m_calculatedTransformB; }
342 
343  const btTransform & getFrameOffsetA() const { return m_frameInA; }
344  const btTransform & getFrameOffsetB() const { return m_frameInB; }
345 
346  btTransform & getFrameOffsetA() { return m_frameInA; }
347  btTransform & getFrameOffsetB() { return m_frameInB; }
348 
349  // Get the rotation axis in global coordinates ( btGeneric6DofSpring2Constraint::calculateTransforms() must be called previously )
350  btVector3 getAxis(int axis_index) const { return m_calculatedAxis[axis_index]; }
351 
352  // Get the relative Euler angle ( btGeneric6DofSpring2Constraint::calculateTransforms() must be called previously )
353  btScalar getAngle(int axis_index) const { return m_calculatedAxisAngleDiff[axis_index]; }
354 
355  // Get the relative position of the constraint pivot ( btGeneric6DofSpring2Constraint::calculateTransforms() must be called previously )
356  btScalar getRelativePivotPosition(int axis_index) const { return m_calculatedLinearDiff[axis_index]; }
357 
358  void setFrames(const btTransform & frameA, const btTransform & frameB);
359 
360  void setLinearLowerLimit(const btVector3& linearLower) { m_linearLimits.m_lowerLimit = linearLower; }
361  void getLinearLowerLimit(btVector3& linearLower) { linearLower = m_linearLimits.m_lowerLimit; }
362  void setLinearUpperLimit(const btVector3& linearUpper) { m_linearLimits.m_upperLimit = linearUpper; }
363  void getLinearUpperLimit(btVector3& linearUpper) { linearUpper = m_linearLimits.m_upperLimit; }
364 
365  void setAngularLowerLimit(const btVector3& angularLower)
366  {
367  for(int i = 0; i < 3; i++)
368  m_angularLimits[i].m_loLimit = btNormalizeAngle(angularLower[i]);
369  }
370 
371  void setAngularLowerLimitReversed(const btVector3& angularLower)
372  {
373  for(int i = 0; i < 3; i++)
374  m_angularLimits[i].m_hiLimit = btNormalizeAngle(-angularLower[i]);
375  }
376 
377  void getAngularLowerLimit(btVector3& angularLower)
378  {
379  for(int i = 0; i < 3; i++)
380  angularLower[i] = m_angularLimits[i].m_loLimit;
381  }
382 
384  {
385  for(int i = 0; i < 3; i++)
386  angularLower[i] = -m_angularLimits[i].m_hiLimit;
387  }
388 
389  void setAngularUpperLimit(const btVector3& angularUpper)
390  {
391  for(int i = 0; i < 3; i++)
392  m_angularLimits[i].m_hiLimit = btNormalizeAngle(angularUpper[i]);
393  }
394 
395  void setAngularUpperLimitReversed(const btVector3& angularUpper)
396  {
397  for(int i = 0; i < 3; i++)
398  m_angularLimits[i].m_loLimit = btNormalizeAngle(-angularUpper[i]);
399  }
400 
401  void getAngularUpperLimit(btVector3& angularUpper)
402  {
403  for(int i = 0; i < 3; i++)
404  angularUpper[i] = m_angularLimits[i].m_hiLimit;
405  }
406 
408  {
409  for(int i = 0; i < 3; i++)
410  angularUpper[i] = -m_angularLimits[i].m_loLimit;
411  }
412 
413  //first 3 are linear, next 3 are angular
414 
415  void setLimit(int axis, btScalar lo, btScalar hi)
416  {
417  if(axis<3)
418  {
419  m_linearLimits.m_lowerLimit[axis] = lo;
420  m_linearLimits.m_upperLimit[axis] = hi;
421  }
422  else
423  {
424  lo = btNormalizeAngle(lo);
425  hi = btNormalizeAngle(hi);
426  m_angularLimits[axis-3].m_loLimit = lo;
427  m_angularLimits[axis-3].m_hiLimit = hi;
428  }
429  }
430 
431  void setLimitReversed(int axis, btScalar lo, btScalar hi)
432  {
433  if(axis<3)
434  {
435  m_linearLimits.m_lowerLimit[axis] = lo;
436  m_linearLimits.m_upperLimit[axis] = hi;
437  }
438  else
439  {
440  lo = btNormalizeAngle(lo);
441  hi = btNormalizeAngle(hi);
442  m_angularLimits[axis-3].m_hiLimit = -lo;
443  m_angularLimits[axis-3].m_loLimit = -hi;
444  }
445  }
446 
447  bool isLimited(int limitIndex)
448  {
449  if(limitIndex<3)
450  {
451  return m_linearLimits.isLimited(limitIndex);
452  }
453  return m_angularLimits[limitIndex-3].isLimited();
454  }
455 
456  void setRotationOrder(RotateOrder order) { m_rotateOrder = order; }
457  RotateOrder getRotationOrder() { return m_rotateOrder; }
458 
459  void setAxis( const btVector3& axis1, const btVector3& axis2);
460 
461  void setBounce(int index, btScalar bounce);
462 
463  void enableMotor(int index, bool onOff);
464  void setServo(int index, bool onOff); // set the type of the motor (servo or not) (the motor has to be turned on for servo also)
465  void setTargetVelocity(int index, btScalar velocity);
466  void setServoTarget(int index, btScalar target);
467  void setMaxMotorForce(int index, btScalar force);
468 
469  void enableSpring(int index, bool onOff);
470  void setStiffness(int index, btScalar stiffness);
471  void setDamping(int index, btScalar damping);
472  void setEquilibriumPoint(); // set the current constraint position/orientation as an equilibrium point for all DOF
473  void setEquilibriumPoint(int index); // set the current constraint position/orientation as an equilibrium point for given DOF
474  void setEquilibriumPoint(int index, btScalar val);
475 
476  //override the default global value of a parameter (such as ERP or CFM), optionally provide the axis (0..5).
477  //If no axis is provided, it uses the default axis for this constraint.
478  virtual void setParam(int num, btScalar value, int axis = -1);
479  virtual btScalar getParam(int num, int axis = -1) const;
480 };
481 
482 
484 {
488 
502  char m_linearEnableMotor[4];
503  char m_linearServoMotor[4];
504  char m_linearEnableSpring[4];
505  char m_padding1[4];
506 
520  char m_angularEnableMotor[4];
521  char m_angularServoMotor[4];
522  char m_angularEnableSpring[4];
523  char m_padding2[4];
524 
526  char m_padding3[4];
527 };
528 
530 {
534 
548  char m_linearEnableMotor[4];
549  char m_linearServoMotor[4];
550  char m_linearEnableSpring[4];
551  char m_padding1[4];
552 
566  char m_angularEnableMotor[4];
567  char m_angularServoMotor[4];
568  char m_angularEnableSpring[4];
569  char m_padding2[4];
570 
572  char m_padding3[4];
573 };
574 
576 {
578 }
579 
580 SIMD_FORCE_INLINE const char* btGeneric6DofSpring2Constraint::serialize(void* dataBuffer, btSerializer* serializer) const
581 {
583  btTypedConstraint::serialize(&dof->m_typeConstraintData,serializer);
584 
585  m_frameInA.serialize(dof->m_rbAFrame);
586  m_frameInB.serialize(dof->m_rbBFrame);
587 
588  int i;
589  for (i=0;i<3;i++)
590  {
591  dof->m_angularLowerLimit.m_floats[i] = m_angularLimits[i].m_loLimit;
592  dof->m_angularUpperLimit.m_floats[i] = m_angularLimits[i].m_hiLimit;
593  dof->m_angularBounce.m_floats[i] = m_angularLimits[i].m_bounce;
594  dof->m_angularStopERP.m_floats[i] = m_angularLimits[i].m_stopERP;
595  dof->m_angularStopCFM.m_floats[i] = m_angularLimits[i].m_stopCFM;
596  dof->m_angularMotorERP.m_floats[i] = m_angularLimits[i].m_motorERP;
597  dof->m_angularMotorCFM.m_floats[i] = m_angularLimits[i].m_motorCFM;
598  dof->m_angularTargetVelocity.m_floats[i] = m_angularLimits[i].m_targetVelocity;
599  dof->m_angularMaxMotorForce.m_floats[i] = m_angularLimits[i].m_maxMotorForce;
600  dof->m_angularServoTarget.m_floats[i] = m_angularLimits[i].m_servoTarget;
601  dof->m_angularSpringStiffness.m_floats[i] = m_angularLimits[i].m_springStiffness;
602  dof->m_angularSpringDamping.m_floats[i] = m_angularLimits[i].m_springDamping;
603  dof->m_angularEquilibriumPoint.m_floats[i] = m_angularLimits[i].m_equilibriumPoint;
604  }
605  dof->m_angularLowerLimit.m_floats[3] = 0;
606  dof->m_angularUpperLimit.m_floats[3] = 0;
607  dof->m_angularBounce.m_floats[3] = 0;
608  dof->m_angularStopERP.m_floats[3] = 0;
609  dof->m_angularStopCFM.m_floats[3] = 0;
610  dof->m_angularMotorERP.m_floats[3] = 0;
611  dof->m_angularMotorCFM.m_floats[3] = 0;
612  dof->m_angularTargetVelocity.m_floats[3] = 0;
613  dof->m_angularMaxMotorForce.m_floats[3] = 0;
614  dof->m_angularServoTarget.m_floats[3] = 0;
615  dof->m_angularSpringStiffness.m_floats[3] = 0;
616  dof->m_angularSpringDamping.m_floats[3] = 0;
617  dof->m_angularEquilibriumPoint.m_floats[3] = 0;
618  for (i=0;i<4;i++)
619  {
620  dof->m_angularEnableMotor[i] = i < 3 ? ( m_angularLimits[i].m_enableMotor ? 1 : 0 ) : 0;
621  dof->m_angularServoMotor[i] = i < 3 ? ( m_angularLimits[i].m_servoMotor ? 1 : 0 ) : 0;
622  dof->m_angularEnableSpring[i] = i < 3 ? ( m_angularLimits[i].m_enableSpring ? 1 : 0 ) : 0;
623  }
624 
625  m_linearLimits.m_lowerLimit.serialize( dof->m_linearLowerLimit );
626  m_linearLimits.m_upperLimit.serialize( dof->m_linearUpperLimit );
627  m_linearLimits.m_bounce.serialize( dof->m_linearBounce );
628  m_linearLimits.m_stopERP.serialize( dof->m_linearStopERP );
629  m_linearLimits.m_stopCFM.serialize( dof->m_linearStopCFM );
630  m_linearLimits.m_motorERP.serialize( dof->m_linearMotorERP );
631  m_linearLimits.m_motorCFM.serialize( dof->m_linearMotorCFM );
632  m_linearLimits.m_targetVelocity.serialize( dof->m_linearTargetVelocity );
633  m_linearLimits.m_maxMotorForce.serialize( dof->m_linearMaxMotorForce );
634  m_linearLimits.m_servoTarget.serialize( dof->m_linearServoTarget );
635  m_linearLimits.m_springStiffness.serialize( dof->m_linearSpringStiffness );
636  m_linearLimits.m_springDamping.serialize( dof->m_linearSpringDamping );
637  m_linearLimits.m_equilibriumPoint.serialize( dof->m_linearEquilibriumPoint );
638  for (i=0;i<4;i++)
639  {
640  dof->m_linearEnableMotor[i] = i < 3 ? ( m_linearLimits.m_enableMotor[i] ? 1 : 0 ) : 0;
641  dof->m_linearServoMotor[i] = i < 3 ? ( m_linearLimits.m_servoMotor[i] ? 1 : 0 ) : 0;
642  dof->m_linearEnableSpring[i] = i < 3 ? ( m_linearLimits.m_enableSpring[i] ? 1 : 0 ) : 0;
643  }
644 
645  dof->m_rotateOrder = m_rotateOrder;
646 
648 }
649 
650 
651 
652 
653 
654 #endif //BT_GENERIC_6DOF_CONSTRAINT_H
void getAngularUpperLimitReversed(btVector3 &angularUpper)
void getAngularLowerLimitReversed(btVector3 &angularLower)
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
Definition: btVector3.h:640
Jacobian entry is an abstraction that allows to describe constraints it can be used in combination wi...
void setLimit(int axis, btScalar lo, btScalar hi)
btGeneric6DofSpring2Constraint & operator=(btGeneric6DofSpring2Constraint &)
btScalar btGetMatrixElem(const btMatrix3x3 &mat, int index)
void setAngularLowerLimitReversed(const btVector3 &angularLower)
#define btAssert(x)
Definition: btScalar.h:113
void getLinearLowerLimit(btVector3 &linearLower)
#define SIMD_FORCE_INLINE
Definition: btScalar.h:63
virtual const char * serialize(void *dataBuffer, btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
const btTransform & getCalculatedTransformA() const
btRotationalLimitMotor2(const btRotationalLimitMotor2 &limot)
btVector3 getAxis(int axis_index) const
void getAngularUpperLimit(btVector3 &angularUpper)
void getLinearUpperLimit(btVector3 &linearUpper)
btTranslationalLimitMotor2 * getTranslationalLimitMotor()
const btTransform & getCalculatedTransformB() const
The btRigidBody is the main class for rigid body objects.
Definition: btRigidBody.h:62
void setLinearUpperLimit(const btVector3 &linearUpper)
btRotationalLimitMotor2 * getRotationalLimitMotor(int index)
this structure is not used, except for loading pre-2.82 .bullet files
void setLinearLowerLimit(const btVector3 &linearLower)
void setAngularLowerLimit(const btVector3 &angularLower)
virtual void buildJacobian()
internal method used by the constraint solver, don&#39;t use them directly
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:83
#define ATTRIBUTE_ALIGNED16(a)
Definition: btScalar.h:64
btScalar btNormalizeAngle(btScalar angleInRadians)
Definition: btScalar.h:724
#define btGeneric6DofSpring2ConstraintDataName
bool matrixToEulerXYZ(const btMatrix3x3 &mat, btVector3 &xyz)
MatrixToEulerXYZ from http://www.geometrictools.com/LibFoundation/Mathematics/Wm4Matrix3.inl.html.
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition: btTransform.h:34
btScalar getRelativePivotPosition(int axis_index) const
btScalar getAngle(int axis_index) const
virtual const char * serialize(void *dataBuffer, btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
TypedConstraint is the baseclass for Bullet constraints and vehicles.
void getAngularLowerLimit(btVector3 &angularLower)
for serialization
Definition: btTransform.h:253
#define BT_DECLARE_ALIGNED_ALLOCATOR()
Definition: btScalar.h:388
#define btGeneric6DofSpring2ConstraintData2
void setAngularUpperLimitReversed(const btVector3 &angularUpper)
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
Definition: btMatrix3x3.h:48
void testLimitValue(btScalar test_value)
void setAngularUpperLimit(const btVector3 &angularUpper)
void setLimitReversed(int axis, btScalar lo, btScalar hi)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:278
btTranslationalLimitMotor2(const btTranslationalLimitMotor2 &other)