Bullet Collision Detection & Physics Library: btHingeConstraint.h Source File

Bullet Collision Detection & Physics Library

btHingeConstraint.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 /* Hinge Constraint by Dirk Gregorius. Limits added by Marcus Hennix at Starbreeze Studios */
17
18 #ifndef BT_HINGECONSTRAINT_H
19 #define BT_HINGECONSTRAINT_H
20
21 #define _BT_USE_CENTER_LIMIT_ 1
22
23
24 #include "LinearMath/btVector3.h"
25 #include "btJacobianEntry.h"
26 #include "btTypedConstraint.h"
27
28 class btRigidBody;
29
30 #ifdef BT_USE_DOUBLE_PRECISION
31 #define btHingeConstraintData btHingeConstraintDoubleData2 //rename to 2 for backwards compatibility, so we can still load the 'btHingeConstraintDoubleData' version
32 #define btHingeConstraintDataName "btHingeConstraintDoubleData2"
33 #else
34 #define btHingeConstraintData btHingeConstraintFloatData
35 #define btHingeConstraintDataName "btHingeConstraintFloatData"
36 #endif //BT_USE_DOUBLE_PRECISION
37
38
39
40 enum btHingeFlags
41 {
42 BT_HINGE_FLAGS_CFM_STOP = 1,
43 BT_HINGE_FLAGS_ERP_STOP = 2,
44 BT_HINGE_FLAGS_CFM_NORM = 4,
45 BT_HINGE_FLAGS_ERP_NORM = 8
46 };
47
48
51 ATTRIBUTE_ALIGNED16(class) btHingeConstraint : public btTypedConstraint
52 {
53 #ifdef IN_PARALLELL_SOLVER
54 public:
55 #endif
56 btJacobianEntry m_jac[3]; //3 orthogonal linear constraints
57 btJacobianEntry m_jacAng[3]; //2 orthogonal angular constraints+ 1 for limit/motor
58
59 btTransform m_rbAFrame; // constraint axii. Assumes z is hinge axis.
60 btTransform m_rbBFrame;
61
62 btScalar m_motorTargetVelocity;
63 btScalar m_maxMotorImpulse;
64
65
66 #ifdef _BT_USE_CENTER_LIMIT_
67 btAngularLimit m_limit;
68 #else
69 btScalar m_lowerLimit;
70 btScalar m_upperLimit;
71 btScalar m_limitSign;
72 btScalar m_correction;
73
74 btScalar m_limitSoftness;
75 btScalar m_biasFactor;
76 btScalar m_relaxationFactor;
77
78 bool m_solveLimit;
79 #endif
80
81 btScalar m_kHinge;
82
83
84 btScalar m_accLimitImpulse;
85 btScalar m_hingeAngle;
86 btScalar m_referenceSign;
87
88 bool m_angularOnly;
89 bool m_enableAngularMotor;
90 bool m_useSolveConstraintObsolete;
91 bool m_useOffsetForConstraintFrame;
92 bool m_useReferenceFrameA;
93
94 btScalar m_accMotorImpulse;
95
96 int m_flags;
97 btScalar m_normalCFM;
98 btScalar m_normalERP;
99 btScalar m_stopCFM;
100 btScalar m_stopERP;
101
102
103 public:
104
105 BT_DECLARE_ALIGNED_ALLOCATOR();
106
107 btHingeConstraint(btRigidBody& rbA,btRigidBody& rbB, const btVector3& pivotInA,const btVector3& pivotInB, const btVector3& axisInA,const btVector3& axisInB, bool useReferenceFrameA = false);
108
109 btHingeConstraint(btRigidBody& rbA,const btVector3& pivotInA,const btVector3& axisInA, bool useReferenceFrameA = false);
110
111 btHingeConstraint(btRigidBody& rbA,btRigidBody& rbB, const btTransform& rbAFrame, const btTransform& rbBFrame, bool useReferenceFrameA = false);
112
113 btHingeConstraint(btRigidBody& rbA,const btTransform& rbAFrame, bool useReferenceFrameA = false);
114
115
116 virtual void buildJacobian();
117
118 virtual void getInfo1 (btConstraintInfo1* info);
119
120 void getInfo1NonVirtual(btConstraintInfo1* info);
121
122 virtual void getInfo2 (btConstraintInfo2* info);
123
124 void getInfo2NonVirtual(btConstraintInfo2* info,const btTransform& transA,const btTransform& transB,const btVector3& angVelA,const btVector3& angVelB);
125
126 void getInfo2Internal(btConstraintInfo2* info,const btTransform& transA,const btTransform& transB,const btVector3& angVelA,const btVector3& angVelB);
127 void getInfo2InternalUsingFrameOffset(btConstraintInfo2* info,const btTransform& transA,const btTransform& transB,const btVector3& angVelA,const btVector3& angVelB);
128
129
130 void updateRHS(btScalar timeStep);
131
132 const btRigidBody& getRigidBodyA() const
133 {
134 return m_rbA;
135 }
136 const btRigidBody& getRigidBodyB() const
137 {
138 return m_rbB;
139 }
140
141 btRigidBody& getRigidBodyA()
142 {
143 return m_rbA;
144 }
145
146 btRigidBody& getRigidBodyB()
147 {
148 return m_rbB;
149 }
150
151 btTransform& getFrameOffsetA()
152 {
153 return m_rbAFrame;
154 }
155
156 btTransform& getFrameOffsetB()
157 {
158 return m_rbBFrame;
159 }
160
161 void setFrames(const btTransform& frameA, const btTransform& frameB);
162
163 void setAngularOnly(bool angularOnly)
164 {
165 m_angularOnly = angularOnly;
166 }
167
168 void enableAngularMotor(bool enableMotor,btScalar targetVelocity,btScalar maxMotorImpulse)
169 {
170 m_enableAngularMotor = enableMotor;
171 m_motorTargetVelocity = targetVelocity;
172 m_maxMotorImpulse = maxMotorImpulse;
173 }
174
175 // extra motor API, including ability to set a target rotation (as opposed to angular velocity)
176 // note: setMotorTarget sets angular velocity under the hood, so you must call it every tick to
177 // maintain a given angular target.
178 void enableMotor(bool enableMotor) { m_enableAngularMotor = enableMotor; }
179 void setMaxMotorImpulse(btScalar maxMotorImpulse) { m_maxMotorImpulse = maxMotorImpulse; }
180 void setMotorTargetVelocity(btScalar motorTargetVelocity) { m_motorTargetVelocity = motorTargetVelocity; }
181 void setMotorTarget(const btQuaternion& qAinB, btScalar dt); // qAinB is rotation of body A wrt body B.
182 void setMotorTarget(btScalar targetAngle, btScalar dt);
183
184
185 void setLimit(btScalar low,btScalar high,btScalar _softness = 0.9f, btScalar _biasFactor = 0.3f, btScalar _relaxationFactor = 1.0f)
186 {
187 #ifdef _BT_USE_CENTER_LIMIT_
188 m_limit.set(low, high, _softness, _biasFactor, _relaxationFactor);
189 #else
190 m_lowerLimit = btNormalizeAngle(low);
191 m_upperLimit = btNormalizeAngle(high);
192 m_limitSoftness = _softness;
193 m_biasFactor = _biasFactor;
194 m_relaxationFactor = _relaxationFactor;
195 #endif
196 }
197
198 btScalar getLimitSoftness() const
199 {
200 #ifdef _BT_USE_CENTER_LIMIT_
201 return m_limit.getSoftness();
202 #else
203 return m_limitSoftness;
204 #endif
205 }
206
207 btScalar getLimitBiasFactor() const
208 {
209 #ifdef _BT_USE_CENTER_LIMIT_
210 return m_limit.getBiasFactor();
211 #else
212 return m_biasFactor;
213 #endif
214 }
215
216 btScalar getLimitRelaxationFactor() const
217 {
218 #ifdef _BT_USE_CENTER_LIMIT_
219 return m_limit.getRelaxationFactor();
220 #else
221 return m_relaxationFactor;
222 #endif
223 }
224
225 void setAxis(btVector3& axisInA)
226 {
227 btVector3 rbAxisA1, rbAxisA2;
228 btPlaneSpace1(axisInA, rbAxisA1, rbAxisA2);
229 btVector3 pivotInA = m_rbAFrame.getOrigin();
230 // m_rbAFrame.getOrigin() = pivotInA;
231 m_rbAFrame.getBasis().setValue( rbAxisA1.getX(),rbAxisA2.getX(),axisInA.getX(),
232 rbAxisA1.getY(),rbAxisA2.getY(),axisInA.getY(),
233 rbAxisA1.getZ(),rbAxisA2.getZ(),axisInA.getZ() );
234
235 btVector3 axisInB = m_rbA.getCenterOfMassTransform().getBasis() * axisInA;
236
237 btQuaternion rotationArc = shortestArcQuat(axisInA,axisInB);
238 btVector3 rbAxisB1 = quatRotate(rotationArc,rbAxisA1);
239 btVector3 rbAxisB2 = axisInB.cross(rbAxisB1);
240
241 m_rbBFrame.getOrigin() = m_rbB.getCenterOfMassTransform().inverse()(m_rbA.getCenterOfMassTransform()(pivotInA));
242
243 m_rbBFrame.getBasis().setValue( rbAxisB1.getX(),rbAxisB2.getX(),axisInB.getX(),
244 rbAxisB1.getY(),rbAxisB2.getY(),axisInB.getY(),
245 rbAxisB1.getZ(),rbAxisB2.getZ(),axisInB.getZ() );
246 m_rbBFrame.getBasis() = m_rbB.getCenterOfMassTransform().getBasis().inverse() * m_rbBFrame.getBasis();
247
248 }
249
250 bool hasLimit() const {
251 #ifdef _BT_USE_CENTER_LIMIT_
252 return m_limit.getHalfRange() > 0;
253 #else
254 return m_lowerLimit <= m_upperLimit;
255 #endif
256 }
257
258 btScalar getLowerLimit() const
259 {
260 #ifdef _BT_USE_CENTER_LIMIT_
261 return m_limit.getLow();
262 #else
263 return m_lowerLimit;
264 #endif
265 }
266
267 btScalar getUpperLimit() const
268 {
269 #ifdef _BT_USE_CENTER_LIMIT_
270 return m_limit.getHigh();
271 #else
272 return m_upperLimit;
273 #endif
274 }
275
276
278 btScalar getHingeAngle();
279
280 btScalar getHingeAngle(const btTransform& transA,const btTransform& transB);
281
282 void testLimit(const btTransform& transA,const btTransform& transB);
283
284
285 const btTransform& getAFrame() const { return m_rbAFrame; };
286 const btTransform& getBFrame() const { return m_rbBFrame; };
287
288 btTransform& getAFrame() { return m_rbAFrame; };
289 btTransform& getBFrame() { return m_rbBFrame; };
290
291 inline int getSolveLimit()
292 {
293 #ifdef _BT_USE_CENTER_LIMIT_
294 return m_limit.isLimit();
295 #else
296 return m_solveLimit;
297 #endif
298 }
299
300 inline btScalar getLimitSign()
301 {
302 #ifdef _BT_USE_CENTER_LIMIT_
303 return m_limit.getSign();
304 #else
305 return m_limitSign;
306 #endif
307 }
308
309 inline bool getAngularOnly()
310 {
311 return m_angularOnly;
312 }
313 inline bool getEnableAngularMotor()
314 {
315 return m_enableAngularMotor;
316 }
317 inline btScalar getMotorTargetVelocity()
318 {
319 return m_motorTargetVelocity;
320 }
321 inline btScalar getMaxMotorImpulse()
322 {
323 return m_maxMotorImpulse;
324 }
325 // access for UseFrameOffset
326 bool getUseFrameOffset() { return m_useOffsetForConstraintFrame; }
327 void setUseFrameOffset(bool frameOffsetOnOff) { m_useOffsetForConstraintFrame = frameOffsetOnOff; }
328 // access for UseReferenceFrameA
329 bool getUseReferenceFrameA() const { return m_useReferenceFrameA; }
330 void setUseReferenceFrameA(bool useReferenceFrameA) { m_useReferenceFrameA = useReferenceFrameA; }
331
334 virtual void setParam(int num, btScalar value, int axis = -1);
336 virtual btScalar getParam(int num, int axis = -1) const;
337
338 virtual int getFlags() const
339 {
340 return m_flags;
341 }
342
343 virtual int calculateSerializeBufferSize() const;
344
346 virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
347
348
349 };
350
351
352 //only for backward compatibility
353 #ifdef BT_BACKWARDS_COMPATIBLE_SERIALIZATION
354 struct btHingeConstraintDoubleData
356 {
357 btTypedConstraintData m_typeConstraintData;
358 btTransformDoubleData m_rbAFrame; // constraint axii. Assumes z is hinge axis.
359 btTransformDoubleData m_rbBFrame;
360 int m_useReferenceFrameA;
361 int m_angularOnly;
362 int m_enableAngularMotor;
363 float m_motorTargetVelocity;
364 float m_maxMotorImpulse;
365
366 float m_lowerLimit;
367 float m_upperLimit;
368 float m_limitSoftness;
369 float m_biasFactor;
370 float m_relaxationFactor;
371
372 };
373 #endif //BT_BACKWARDS_COMPATIBLE_SERIALIZATION
374
376 ATTRIBUTE_ALIGNED16(class) btHingeAccumulatedAngleConstraint : public btHingeConstraint
377 {
378 protected:
379 btScalar m_accumulatedAngle;
380 public:
381
382 BT_DECLARE_ALIGNED_ALLOCATOR();
383
384 btHingeAccumulatedAngleConstraint(btRigidBody& rbA,btRigidBody& rbB, const btVector3& pivotInA,const btVector3& pivotInB, const btVector3& axisInA,const btVector3& axisInB, bool useReferenceFrameA = false)
385 :btHingeConstraint(rbA,rbB,pivotInA,pivotInB, axisInA,axisInB, useReferenceFrameA )
386 {
387 m_accumulatedAngle=getHingeAngle();
388 }
389
390 btHingeAccumulatedAngleConstraint(btRigidBody& rbA,const btVector3& pivotInA,const btVector3& axisInA, bool useReferenceFrameA = false)
391 :btHingeConstraint(rbA,pivotInA,axisInA, useReferenceFrameA)
392 {
393 m_accumulatedAngle=getHingeAngle();
394 }
395
396 btHingeAccumulatedAngleConstraint(btRigidBody& rbA,btRigidBody& rbB, const btTransform& rbAFrame, const btTransform& rbBFrame, bool useReferenceFrameA = false)
397 :btHingeConstraint(rbA,rbB, rbAFrame, rbBFrame, useReferenceFrameA )
398 {
399 m_accumulatedAngle=getHingeAngle();
400 }
401
402 btHingeAccumulatedAngleConstraint(btRigidBody& rbA,const btTransform& rbAFrame, bool useReferenceFrameA = false)
403 :btHingeConstraint(rbA,rbAFrame, useReferenceFrameA )
404 {
405 m_accumulatedAngle=getHingeAngle();
406 }
407 btScalar getAccumulatedHingeAngle();
408 void setAccumulatedHingeAngle(btScalar accAngle);
409 virtual void getInfo1 (btConstraintInfo1* info);
410
411 };
412
413 struct btHingeConstraintFloatData
414 {
415 btTypedConstraintData m_typeConstraintData;
416 btTransformFloatData m_rbAFrame; // constraint axii. Assumes z is hinge axis.
417 btTransformFloatData m_rbBFrame;
418 int m_useReferenceFrameA;
419 int m_angularOnly;
420
421 int m_enableAngularMotor;
422 float m_motorTargetVelocity;
423 float m_maxMotorImpulse;
424
425 float m_lowerLimit;
426 float m_upperLimit;
427 float m_limitSoftness;
428 float m_biasFactor;
429 float m_relaxationFactor;
430
431 };
432
433
434
436 struct btHingeConstraintDoubleData2
437 {
438 btTypedConstraintDoubleData m_typeConstraintData;
439 btTransformDoubleData m_rbAFrame; // constraint axii. Assumes z is hinge axis.
440 btTransformDoubleData m_rbBFrame;
441 int m_useReferenceFrameA;
442 int m_angularOnly;
443 int m_enableAngularMotor;
444 double m_motorTargetVelocity;
445 double m_maxMotorImpulse;
446
447 double m_lowerLimit;
448 double m_upperLimit;
449 double m_limitSoftness;
450 double m_biasFactor;
451 double m_relaxationFactor;
452 char m_padding1[4];
453
454 };
455
456
457
458
459 SIMD_FORCE_INLINE int btHingeConstraint::calculateSerializeBufferSize() const
460 {
461 return sizeof(btHingeConstraintData);
462 }
463
465 SIMD_FORCE_INLINE const char* btHingeConstraint::serialize(void* dataBuffer, btSerializer* serializer) const
466 {
467 btHingeConstraintData* hingeData = (btHingeConstraintData*)dataBuffer;
468 btTypedConstraint::serialize(&hingeData->m_typeConstraintData,serializer);
469
470 m_rbAFrame.serialize(hingeData->m_rbAFrame);
471 m_rbBFrame.serialize(hingeData->m_rbBFrame);
472
473 hingeData->m_angularOnly = m_angularOnly;
474 hingeData->m_enableAngularMotor = m_enableAngularMotor;
475 hingeData->m_maxMotorImpulse = float(m_maxMotorImpulse);
476 hingeData->m_motorTargetVelocity = float(m_motorTargetVelocity);
477 hingeData->m_useReferenceFrameA = m_useReferenceFrameA;
478 #ifdef _BT_USE_CENTER_LIMIT_
479 hingeData->m_lowerLimit = float(m_limit.getLow());
480 hingeData->m_upperLimit = float(m_limit.getHigh());
481 hingeData->m_limitSoftness = float(m_limit.getSoftness());
482 hingeData->m_biasFactor = float(m_limit.getBiasFactor());
483 hingeData->m_relaxationFactor = float(m_limit.getRelaxationFactor());
484 #else
485 hingeData->m_lowerLimit = float(m_lowerLimit);
486 hingeData->m_upperLimit = float(m_upperLimit);
487 hingeData->m_limitSoftness = float(m_limitSoftness);
488 hingeData->m_biasFactor = float(m_biasFactor);
489 hingeData->m_relaxationFactor = float(m_relaxationFactor);
490 #endif
491
492 // Fill padding with zeros to appease msan.
493 #ifdef BT_USE_DOUBLE_PRECISION
494 hingeData->m_padding1[0] = 0;
495 hingeData->m_padding1[1] = 0;
496 hingeData->m_padding1[2] = 0;
497 hingeData->m_padding1[3] = 0;
498 #endif
499
500 return btHingeConstraintDataName;
501 }
502
503 #endif //BT_HINGECONSTRAINT_H
btHingeConstraint::setUseFrameOffset
void setUseFrameOffset(bool frameOffsetOnOff)
Definition: btHingeConstraint.h:327
btHingeConstraint::getLimitBiasFactor
btScalar getLimitBiasFactor() const
Definition: btHingeConstraint.h:207
btHingeConstraintDoubleData::m_rbBFrame
btTransformDoubleData m_rbBFrame
Definition: btHingeConstraint.h:359
btHingeConstraintDoubleData2::m_biasFactor
double m_biasFactor
Definition: btHingeConstraint.h:450
btHingeConstraintFloatData::m_rbAFrame
btTransformFloatData m_rbAFrame
Definition: btHingeConstraint.h:416
btHingeConstraint::getUpperLimit
btScalar getUpperLimit() const
Definition: btHingeConstraint.h:267
btAngularLimit
Definition: btTypedConstraint.h:447
btHingeConstraint::getBFrame
btTransform & getBFrame()
Definition: btHingeConstraint.h:289
btHingeConstraint::getRigidBodyB
const btRigidBody & getRigidBodyB() const
Definition: btHingeConstraint.h:136
btHingeConstraint::hasLimit
bool hasLimit() const
Definition: btHingeConstraint.h:250
btHingeConstraint::getBFrame
const btTransform & getBFrame() const
Definition: btHingeConstraint.h:286
btJacobianEntry
Jacobian entry is an abstraction that allows to describe constraints it can be used in combination wi...
Definition: btJacobianEntry.h:30
btTypedConstraint::btConstraintInfo2
Definition: btTypedConstraint.h:126
btHingeConstraint::getMotorTargetVelocity
btScalar getMotorTargetVelocity()
Definition: btHingeConstraint.h:317
btHingeConstraint::getLowerLimit
btScalar getLowerLimit() const
Definition: btHingeConstraint.h:258
btHingeConstraint::serialize
virtual const char * serialize(void *dataBuffer, btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
Definition: btHingeConstraint.h:465
btVector3.h
btHingeConstraintDoubleData2::m_motorTargetVelocity
double m_motorTargetVelocity
Definition: btHingeConstraint.h:444
btHingeConstraintFloatData::m_motorTargetVelocity
float m_motorTargetVelocity
Definition: btHingeConstraint.h:422
btHingeConstraint::m_rbAFrame
btTransform m_rbAFrame
Definition: btHingeConstraint.h:59
btHingeConstraintDoubleData::m_lowerLimit
float m_lowerLimit
Definition: btHingeConstraint.h:366
btHingeConstraint::m_useSolveConstraintObsolete
bool m_useSolveConstraintObsolete
Definition: btHingeConstraint.h:90
btHingeConstraint::m_accMotorImpulse
btScalar m_accMotorImpulse
Definition: btHingeConstraint.h:94
btAngularLimit::getHalfRange
btScalar getHalfRange() const
Gives half of the distance between min and max limit angle.
Definition: btTypedConstraint.h:515
btPlaneSpace1
void btPlaneSpace1(const T &n, T &p, T &q)
Definition: btVector3.h:1283
btHingeConstraintDoubleData
this structure is not used, except for loading pre-2.82 .bullet files
Definition: btHingeConstraint.h:355
btRigidBody::calculateSerializeBufferSize
virtual int calculateSerializeBufferSize() const
Definition: btRigidBody.cpp:476
btHingeConstraintData
#define btHingeConstraintData
Definition: btHingeConstraint.h:34
btHingeConstraint::m_enableAngularMotor
bool m_enableAngularMotor
Definition: btHingeConstraint.h:89
SIMD_FORCE_INLINE
#define SIMD_FORCE_INLINE
Definition: btScalar.h:81
btVector3::getY
const btScalar & getY() const
Return the y value.
Definition: btVector3.h:575
btHingeConstraint::getLimitSign
btScalar getLimitSign()
Definition: btHingeConstraint.h:300
btHingeConstraintDoubleData2::m_typeConstraintData
btTypedConstraintDoubleData m_typeConstraintData
Definition: btHingeConstraint.h:438
btHingeConstraintFloatData::m_upperLimit
float m_upperLimit
Definition: btHingeConstraint.h:426
btAngularLimit::getRelaxationFactor
btScalar getRelaxationFactor() const
Returns limit&#39;s relaxation factor.
Definition: btTypedConstraint.h:497
btHingeConstraint::m_motorTargetVelocity
btScalar m_motorTargetVelocity
Definition: btHingeConstraint.h:62
BT_HINGE_FLAGS_CFM_STOP
Definition: btHingeConstraint.h:42
BT_HINGE_FLAGS_ERP_NORM
Definition: btHingeConstraint.h:45
BT_HINGE_FLAGS_CFM_NORM
Definition: btHingeConstraint.h:44
btHingeConstraint::m_stopCFM
btScalar m_stopCFM
Definition: btHingeConstraint.h:99
btHingeConstraint
hinge constraint between two rigidbodies each with a pivotpoint that descibes the axis location in lo...
Definition: btHingeConstraint.h:51
btHingeConstraint::getAngularOnly
bool getAngularOnly()
Definition: btHingeConstraint.h:309
btHingeConstraintDoubleData2::m_maxMotorImpulse
double m_maxMotorImpulse
Definition: btHingeConstraint.h:445
btSerializer
Definition: btSerializer.h:68
btHingeConstraint::getLimitRelaxationFactor
btScalar getLimitRelaxationFactor() const
Definition: btHingeConstraint.h:216
quatRotate
btVector3 quatRotate(const btQuaternion &rotation, const btVector3 &v)
Definition: btQuaternion.h:917
btHingeConstraintFloatData::m_limitSoftness
float m_limitSoftness
Definition: btHingeConstraint.h:427
btHingeAccumulatedAngleConstraint::btHingeAccumulatedAngleConstraint
btHingeAccumulatedAngleConstraint(btRigidBody &rbA, btRigidBody &rbB, const btTransform &rbAFrame, const btTransform &rbBFrame, bool useReferenceFrameA=false)
Definition: btHingeConstraint.h:396
btHingeAccumulatedAngleConstraint::m_accumulatedAngle
btScalar m_accumulatedAngle
Definition: btHingeConstraint.h:379
btTypedConstraint.h
btVector3::getZ
const btScalar & getZ() const
Return the z value.
Definition: btVector3.h:577
btAngularLimit::getBiasFactor
btScalar getBiasFactor() const
Returns limit&#39;s bias factor.
Definition: btTypedConstraint.h:491
btHingeConstraint::getFlags
virtual int getFlags() const
Definition: btHingeConstraint.h:338
btHingeConstraint::getUseFrameOffset
bool getUseFrameOffset()
Definition: btHingeConstraint.h:326
btHingeConstraintDoubleData2::m_angularOnly
int m_angularOnly
Definition: btHingeConstraint.h:442
btHingeConstraintFloatData::m_biasFactor
float m_biasFactor
Definition: btHingeConstraint.h:428
btTransform::getOrigin
btVector3 & getOrigin()
Return the origin vector translation.
Definition: btTransform.h:117
btHingeConstraint::m_accLimitImpulse
btScalar m_accLimitImpulse
Definition: btHingeConstraint.h:84
shortestArcQuat
btQuaternion shortestArcQuat(const btVector3 &v0, const btVector3 &v1)
Definition: btQuaternion.h:931
btHingeConstraintDoubleData::m_motorTargetVelocity
float m_motorTargetVelocity
Definition: btHingeConstraint.h:363
btAngularLimit::set
void set(btScalar low, btScalar high, btScalar _softness=0.9f, btScalar _biasFactor=0.3f, btScalar _relaxationFactor=1.0f)
Sets all limit&#39;s parameters.
Definition: btTypedConstraint.cpp:156
btHingeConstraint::m_referenceSign
btScalar m_referenceSign
Definition: btHingeConstraint.h:86
btHingeConstraintDoubleData2::m_relaxationFactor
double m_relaxationFactor
Definition: btHingeConstraint.h:451
btHingeConstraintDoubleData::m_relaxationFactor
float m_relaxationFactor
Definition: btHingeConstraint.h:370
btHingeConstraint::getMaxMotorImpulse
btScalar getMaxMotorImpulse()
Definition: btHingeConstraint.h:321
btHingeConstraint::m_rbBFrame
btTransform m_rbBFrame
Definition: btHingeConstraint.h:60
btHingeConstraint::m_stopERP
btScalar m_stopERP
Definition: btHingeConstraint.h:100
btAngularLimit::getSoftness
btScalar getSoftness() const
Returns limit&#39;s softness.
Definition: btTypedConstraint.h:485
btVector3::cross
btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector.
Definition: btVector3.h:389
btHingeConstraint::setAxis
void setAxis(btVector3 &axisInA)
Definition: btHingeConstraint.h:225
btAngularLimit::getSign
btScalar getSign() const
Returns sign value evaluated when test() was invoked.
Definition: btTypedConstraint.h:509
btTypedConstraintDoubleData
Definition: btTypedConstraint.h:416
btHingeConstraintFloatData::m_relaxationFactor
float m_relaxationFactor
Definition: btHingeConstraint.h:429
btTransform::getBasis
btMatrix3x3 & getBasis()
Return the basis matrix for the rotation.
Definition: btTransform.h:112
btHingeConstraint::m_hingeAngle
btScalar m_hingeAngle
Definition: btHingeConstraint.h:85
btHingeConstraintDoubleData2::m_limitSoftness
double m_limitSoftness
Definition: btHingeConstraint.h:449
btMatrix3x3::setValue
void setValue(const btScalar &xx, const btScalar &xy, const btScalar &xz, const btScalar &yx, const btScalar &yy, const btScalar &yz, const btScalar &zx, const btScalar &zy, const btScalar &zz)
Set the values of the matrix explicitly (row major)
Definition: btMatrix3x3.h:198
btHingeConstraint::m_maxMotorImpulse
btScalar m_maxMotorImpulse
Definition: btHingeConstraint.h:63
btHingeConstraint::setUseReferenceFrameA
void setUseReferenceFrameA(bool useReferenceFrameA)
Definition: btHingeConstraint.h:330
btHingeConstraint::getSolveLimit
int getSolveLimit()
Definition: btHingeConstraint.h:291
btRigidBody
The btRigidBody is the main class for rigid body objects.
Definition: btRigidBody.h:62
btHingeConstraintFloatData::m_typeConstraintData
btTypedConstraintData m_typeConstraintData
Definition: btHingeConstraint.h:415
btTransform::serialize
void serialize(struct btTransformData &dataOut) const
Definition: btTransform.h:267
btHingeConstraint::getLimitSoftness
btScalar getLimitSoftness() const
Definition: btHingeConstraint.h:198
btHingeConstraint::m_kHinge
btScalar m_kHinge
Definition: btHingeConstraint.h:81
btTypedConstraintData
this structure is not used, except for loading pre-2.82 .bullet files
Definition: btTypedConstraint.h:393
btHingeConstraintDoubleData::m_upperLimit
float m_upperLimit
Definition: btHingeConstraint.h:367
btAngularLimit::getLow
btScalar getLow() const
Definition: btTypedConstraint.cpp:214
btHingeConstraint::m_flags
int m_flags
Definition: btHingeConstraint.h:96
btJacobianEntry.h
btHingeConstraint::getRigidBodyA
btRigidBody & getRigidBodyA()
Definition: btHingeConstraint.h:141
btVector3
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:83
ATTRIBUTE_ALIGNED16
#define ATTRIBUTE_ALIGNED16(a)
Definition: btScalar.h:82
btHingeConstraint::getAFrame
const btTransform & getAFrame() const
Definition: btHingeConstraint.h:285
btHingeConstraint::setMotorTargetVelocity
void setMotorTargetVelocity(btScalar motorTargetVelocity)
Definition: btHingeConstraint.h:180
btHingeConstraint::getAFrame
btTransform & getAFrame()
Definition: btHingeConstraint.h:288
btAngularLimit::getHigh
btScalar getHigh() const
Definition: btTypedConstraint.cpp:219
btNormalizeAngle
btScalar btNormalizeAngle(btScalar angleInRadians)
Definition: btScalar.h:759
btHingeConstraintFloatData::m_useReferenceFrameA
int m_useReferenceFrameA
Definition: btHingeConstraint.h:418
btHingeConstraint::m_useOffsetForConstraintFrame
bool m_useOffsetForConstraintFrame
Definition: btHingeConstraint.h:91
btHingeConstraint::getUseReferenceFrameA
bool getUseReferenceFrameA() const
Definition: btHingeConstraint.h:329
btHingeConstraintDoubleData2::m_padding1
char m_padding1[4]
Definition: btHingeConstraint.h:452
btHingeConstraint::setAngularOnly
void setAngularOnly(bool angularOnly)
Definition: btHingeConstraint.h:163
btTransform
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition: btTransform.h:34
btHingeConstraint::m_normalCFM
btScalar m_normalCFM
Definition: btHingeConstraint.h:97
btHingeConstraint::m_useReferenceFrameA
bool m_useReferenceFrameA
Definition: btHingeConstraint.h:92
btHingeConstraintDoubleData::m_angularOnly
int m_angularOnly
Definition: btHingeConstraint.h:361
btHingeConstraint::getEnableAngularMotor
bool getEnableAngularMotor()
Definition: btHingeConstraint.h:313
btHingeConstraintDoubleData::m_biasFactor
float m_biasFactor
Definition: btHingeConstraint.h:369
btTypedConstraint::serialize
virtual const char * serialize(void *dataBuffer, btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
Definition: btTypedConstraint.cpp:110
btHingeConstraintDoubleData::m_rbAFrame
btTransformDoubleData m_rbAFrame
Definition: btHingeConstraint.h:358
btTypedConstraint
TypedConstraint is the baseclass for Bullet constraints and vehicles.
Definition: btTypedConstraint.h:78
btAngularLimit::isLimit
bool isLimit() const
Returns true when the last test() invocation recognized limit violation.
Definition: btTypedConstraint.h:521
btHingeConstraint::setLimit
void setLimit(btScalar low, btScalar high, btScalar _softness=0.9f, btScalar _biasFactor=0.3f, btScalar _relaxationFactor=1.0f)
Definition: btHingeConstraint.h:185
btHingeConstraintFloatData::m_angularOnly
int m_angularOnly
Definition: btHingeConstraint.h:419
btTransformFloatData
for serialization
Definition: btTransform.h:253
btHingeConstraint::enableMotor
void enableMotor(bool enableMotor)
Definition: btHingeConstraint.h:178
btHingeConstraintFloatData::m_enableAngularMotor
int m_enableAngularMotor
Definition: btHingeConstraint.h:421
btHingeConstraintDoubleData2::m_upperLimit
double m_upperLimit
Definition: btHingeConstraint.h:448
btHingeConstraintFloatData
Definition: btHingeConstraint.h:413
BT_HINGE_FLAGS_ERP_STOP
Definition: btHingeConstraint.h:43
BT_DECLARE_ALIGNED_ALLOCATOR
#define BT_DECLARE_ALIGNED_ALLOCATOR()
Definition: btScalar.h:403
btHingeConstraint::calculateSerializeBufferSize
virtual int calculateSerializeBufferSize() const
Definition: btHingeConstraint.h:459
btHingeConstraint::m_angularOnly
bool m_angularOnly
Definition: btHingeConstraint.h:88
btHingeAccumulatedAngleConstraint::btHingeAccumulatedAngleConstraint
btHingeAccumulatedAngleConstraint(btRigidBody &rbA, const btTransform &rbAFrame, bool useReferenceFrameA=false)
Definition: btHingeConstraint.h:402
btHingeConstraint::getFrameOffsetB
btTransform & getFrameOffsetB()
Definition: btHingeConstraint.h:156
btHingeConstraintFloatData::m_maxMotorImpulse
float m_maxMotorImpulse
Definition: btHingeConstraint.h:423
btHingeConstraintDoubleData2::m_rbBFrame
btTransformDoubleData m_rbBFrame
Definition: btHingeConstraint.h:440
btHingeConstraint::getRigidBodyB
btRigidBody & getRigidBodyB()
Definition: btHingeConstraint.h:146
btHingeConstraintDoubleData::m_enableAngularMotor
int m_enableAngularMotor
Definition: btHingeConstraint.h:362
btHingeAccumulatedAngleConstraint::btHingeAccumulatedAngleConstraint
btHingeAccumulatedAngleConstraint(btRigidBody &rbA, const btVector3 &pivotInA, const btVector3 &axisInA, bool useReferenceFrameA=false)
Definition: btHingeConstraint.h:390
btHingeConstraintDoubleData2::m_lowerLimit
double m_lowerLimit
Definition: btHingeConstraint.h:447
btHingeConstraintDataName
#define btHingeConstraintDataName
Definition: btHingeConstraint.h:35
btHingeAccumulatedAngleConstraint
The getAccumulatedHingeAngle returns the accumulated hinge angle, taking rotation across the -PI/PI b...
Definition: btHingeConstraint.h:376
btHingeConstraintDoubleData2::m_rbAFrame
btTransformDoubleData m_rbAFrame
Definition: btHingeConstraint.h:439
btQuaternion
The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatr...
Definition: btQuaternion.h:55
btHingeConstraintFloatData::m_lowerLimit
float m_lowerLimit
Definition: btHingeConstraint.h:425
btHingeConstraint::setMaxMotorImpulse
void setMaxMotorImpulse(btScalar maxMotorImpulse)
Definition: btHingeConstraint.h:179
btHingeConstraintDoubleData::m_limitSoftness
float m_limitSoftness
Definition: btHingeConstraint.h:368
btHingeConstraint::m_limit
btAngularLimit m_limit
Definition: btHingeConstraint.h:67
btMatrix3x3::inverse
btMatrix3x3 inverse() const
Return the inverse of the matrix.
Definition: btMatrix3x3.h:1003
btHingeConstraintDoubleData2::m_enableAngularMotor
int m_enableAngularMotor
Definition: btHingeConstraint.h:443
btHingeConstraint::getRigidBodyA
const btRigidBody & getRigidBodyA() const
Definition: btHingeConstraint.h:132
btTypedConstraint::btConstraintInfo1
Definition: btTypedConstraint.h:120
btHingeConstraintDoubleData::m_maxMotorImpulse
float m_maxMotorImpulse
Definition: btHingeConstraint.h:364
btTransformDoubleData
Definition: btTransform.h:259
btHingeConstraint::m_normalERP
btScalar m_normalERP
Definition: btHingeConstraint.h:98
btHingeConstraint::getFrameOffsetA
btTransform & getFrameOffsetA()
Definition: btHingeConstraint.h:151
btHingeFlags
btHingeFlags
Definition: btHingeConstraint.h:40
btHingeConstraintDoubleData::m_useReferenceFrameA
int m_useReferenceFrameA
Definition: btHingeConstraint.h:360
btHingeConstraintDoubleData::m_typeConstraintData
btTypedConstraintData m_typeConstraintData
Definition: btHingeConstraint.h:357
btRigidBody::serialize
virtual const char * serialize(void *dataBuffer, class btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
Definition: btRigidBody.cpp:483
btVector3::getX
const btScalar & getX() const
Return the x value.
Definition: btVector3.h:573
btHingeConstraintDoubleData2
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btHingeConstraint.h:436
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:292
btHingeConstraintDoubleData2::m_useReferenceFrameA
int m_useReferenceFrameA
Definition: btHingeConstraint.h:441
btHingeConstraint::enableAngularMotor
void enableAngularMotor(bool enableMotor, btScalar targetVelocity, btScalar maxMotorImpulse)
Definition: btHingeConstraint.h:168
btHingeAccumulatedAngleConstraint::btHingeAccumulatedAngleConstraint
btHingeAccumulatedAngleConstraint(btRigidBody &rbA, btRigidBody &rbB, const btVector3 &pivotInA, const btVector3 &pivotInB, const btVector3 &axisInA, const btVector3 &axisInB, bool useReferenceFrameA=false)
Definition: btHingeConstraint.h:384
btHingeConstraintFloatData::m_rbBFrame
btTransformFloatData m_rbBFrame
Definition: btHingeConstraint.h:417