56 poly1.
Set(vertices, 3);
59 vertices[1] = p5 - p4;
60 vertices[2] = p6 - p4;
61 poly2.
Set(vertices, 3);
70 poly1.
Set(vertices, 3);
73 vertices[1] = p6 - p4;
74 vertices[2] = p5 - p4;
75 poly2.
Set(vertices, 3);
102 float dampingRatio = 0.5f;
103 float frequencyHz = 10.0f;
105 jd.
Initialize(body1, body2, p2 + m_offset, p5 + m_offset);
109 jd.
Initialize(body1, body2, p3 + m_offset, p4 + m_offset);
153 for (
int32 i = 0; i < 40; ++i)
209 wheelAnchor = pivot +
b2Vec2(0.0
f, -0.8
f);
b2Fixture * CreateFixture(const b2FixtureDef *def)
void Keyboard(int key) override
float density
The density, usually in kg/m^2.
B2_API const b2Vec2 b2Vec2_zero
Useful constant.
void SetMotorSpeed(float speed)
Set the motor speed in radians per second.
bool IsMotorEnabled() const
Is the joint motor enabled?
void Initialize(b2Body *bodyA, b2Body *bodyB, const b2Vec2 &anchor)
void SetTransform(const b2Vec2 &position, float angle)
float stiffness
The linear stiffness in N/m.
const b2Vec2 & GetPosition() const
void SetTwoSided(const b2Vec2 &v1, const b2Vec2 &v2)
Set this as an isolated edge. Collision is two-sided.
void SetAsBox(float hx, float hy)
void EnableMotor(bool flag)
Enable/disable the joint motor.
A rigid body. These are created via b2World::CreateBody.
void Initialize(b2Body *bodyA, b2Body *bodyB, const b2Vec2 &anchorA, const b2Vec2 &anchorB)
void CreateLeg(float s, const b2Vec2 &wheelAnchor)
b2Filter filter
Contact filtering data.
b2Joint * CreateJoint(const b2JointDef *def)
bool collideConnected
Set this flag to true if the attached bodies should collide.
void Set(float x_, float y_)
Set this vector to some specified coordinates.
b2RevoluteJoint * m_motorJoint
bool enableMotor
A flag to enable the joint motor.
B2_API void b2LinearStiffness(float &stiffness, float &damping, float frequencyHertz, float dampingRatio, const b2Body *bodyA, const b2Body *bodyB)
Utility to compute linear stiffness values from frequency and damping ratio.
float motorSpeed
The desired motor speed. Usually in radians per second.
void Set(const b2Vec2 *points, int32 count)
int RegisterTest(const char *category, const char *name, TestCreateFcn *fcn)
void DrawString(int x, int y, const char *string,...)
virtual void Step(Settings &settings)
b2Body * bodyA
The first attached body.
float damping
The linear damping in N*s/m.
b2Body * CreateBody(const b2BodyDef *def)
b2Body * bodyB
The second attached body.
void Step(Settings &settings) override