b2MotorJoint.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2006-2012 Erin Catto http://www.box2d.org
3 *
4 * This software is provided 'as-is', without any express or implied
5 * warranty. In no event will the authors be held liable for any damages
6 * 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
9 * freely, subject to the following restrictions:
10 * 1. The origin of this software must not be misrepresented; you must not
11 * claim that you wrote the original software. If you use this software
12 * in a product, an acknowledgment in the product documentation would be
13 * appreciated but is not required.
14 * 2. Altered source versions must be plainly marked as such, and must not be
15 * misrepresented as being the original software.
16 * 3. This notice may not be removed or altered from any source distribution.
17 */
18 
19 #ifndef B2_MOTOR_JOINT_H
20 #define B2_MOTOR_JOINT_H
21 
23 
25 struct b2MotorJointDef : public b2JointDef
26 {
28  {
31  angularOffset = 0.0f;
32  maxForce = 1.0f;
33  maxTorque = 1.0f;
34  correctionFactor = 0.3f;
35  }
36 
39 
42 
45 
48 
51 
54 };
55 
59 class b2MotorJoint : public b2Joint
60 {
61 public:
62  b2Vec2 GetAnchorA() const;
63  b2Vec2 GetAnchorB() const;
64 
65  b2Vec2 GetReactionForce(float32 inv_dt) const;
66  float32 GetReactionTorque(float32 inv_dt) const;
67 
69  void SetLinearOffset(const b2Vec2& linearOffset);
70  const b2Vec2& GetLinearOffset() const;
71 
73  void SetAngularOffset(float32 angularOffset);
74  float32 GetAngularOffset() const;
75 
77  void SetMaxForce(float32 force);
78 
80  float32 GetMaxForce() const;
81 
83  void SetMaxTorque(float32 torque);
84 
86  float32 GetMaxTorque() const;
87 
89  void SetCorrectionFactor(float32 factor);
90 
92  float32 GetCorrectionFactor() const;
93 
95  void Dump();
96 
97 protected:
98 
99  friend class b2Joint;
100 
101  b2MotorJoint(const b2MotorJointDef* def);
102 
106 
107  // Solver shared
115 
116  // Solver temp
131 };
132 
133 #endif
virtual void SolveVelocityConstraints(const b2SolverData &data)=0
float32 m_angularOffset
Definition: b2MotorJoint.h:109
Joint definitions are used to construct joints.
Definition: b2Joint.h:74
void Initialize(b2Body *bodyA, b2Body *bodyB)
Initialize the bodies and offsets using the current transforms.
float32 m_maxTorque
Definition: b2MotorJoint.h:113
float32 maxTorque
The maximum motor torque in N-m.
Definition: b2MotorJoint.h:50
b2Vec2 linearOffset
Position of bodyB minus the position of bodyA, in bodyA's frame, in meters.
Definition: b2MotorJoint.h:41
b2Vec2 m_localCenterB
Definition: b2MotorJoint.h:122
float32 m_invIA
Definition: b2MotorJoint.h:127
Solver Data.
Definition: b2TimeStep.h:63
void SetZero()
Set this vector to all zeros.
Definition: b2Math.h:61
A 2D column vector.
Definition: b2Math.h:52
float32 m_invMassB
Definition: b2MotorJoint.h:126
signed int int32
Definition: b2Settings.h:31
A rigid body. These are created via b2World::CreateBody.
Definition: b2Body.h:126
float32 m_maxForce
Definition: b2MotorJoint.h:112
virtual void InitVelocityConstraints(const b2SolverData &data)=0
virtual bool SolvePositionConstraints(const b2SolverData &data)=0
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
float32 correctionFactor
Position correction factor in the range [0,1].
Definition: b2MotorJoint.h:53
b2Mat22 m_linearMass
Definition: b2MotorJoint.h:129
float32 maxForce
The maximum motor force in N.
Definition: b2MotorJoint.h:47
float32 m_angularImpulse
Definition: b2MotorJoint.h:111
float32 m_correctionFactor
Definition: b2MotorJoint.h:114
b2Vec2 m_localCenterA
Definition: b2MotorJoint.h:121
float32 m_angularError
Definition: b2MotorJoint.h:124
b2Vec2 m_linearError
Definition: b2MotorJoint.h:123
float32 m_angularMass
Definition: b2MotorJoint.h:130
b2Vec2 m_linearImpulse
Definition: b2MotorJoint.h:110
A 2-by-2 matrix. Stored in column-major order.
Definition: b2Math.h:182
float32 m_invIB
Definition: b2MotorJoint.h:128
GLuint GLuint GLsizei GLenum type
float32 m_invMassA
Definition: b2MotorJoint.h:125
b2Body * bodyA
The first attached body.
Definition: b2Joint.h:92
b2Vec2 m_linearOffset
Definition: b2MotorJoint.h:108
Motor joint definition.
Definition: b2MotorJoint.h:25
float32 angularOffset
The bodyB angle minus bodyA angle in radians.
Definition: b2MotorJoint.h:44
b2Body * bodyB
The second attached body.
Definition: b2Joint.h:95
float float32
Definition: b2Settings.h:35


mvsim
Author(s):
autogenerated on Fri May 7 2021 03:05:51