Go to the documentation of this file.
35 const float k_restitution = 0.4f;
78 poly1.
Set(vertices, 3);
93 poly2.
Set(vertices, 3);
109 float gravity = 10.0f;
116 float radius =
b2Sqrt(2.0
f * I / mass);
124 jd.
maxForce = 0.5f * mass * gravity;
125 jd.
maxTorque = 0.2f * mass * radius * gravity;
139 for (
int i = 0; i < 10; ++i)
149 float gravity = 10.0f;
154 float radius =
b2Sqrt(2.0
f * I / mass);
163 jd.
maxTorque = 0.1f * mass * radius * gravity;
void Set(float angle)
Set using an angle in radians.
void SetGravity(const b2Vec2 &gravity)
Change the global gravity vector.
Friction joint definition.
void ApplyForce(const b2Vec2 &force, const b2Vec2 &point, bool wake)
float maxForce
The maximum friction force in N.
void ApplyTorque(float torque, bool wake)
A rigid body. These are created via b2World::CreateBody.
b2Vec2 GetXAxis() const
Get the x-axis.
void SetZero()
Set this vector to all zeros.
b2Vec2 b2Mul(const b2Mat22 &A, const b2Vec2 &v)
void Set(float x_, float y_)
Set this vector to some specified coordinates.
void SetTwoSided(const b2Vec2 &v1, const b2Vec2 &v2)
Set this as an isolated edge. Collision is two-sided.
void Set(const b2Vec2 *points, int32 count)
b2Joint * CreateJoint(const b2JointDef *def)
float restitution
The restitution (elasticity) usually in the range [0,1].
b2Vec2 GetWorldVector(const b2Vec2 &localVector) const
float friction
The friction coefficient, usually in the range [0,1].
void DrawString(int x, int y, const char *string,...)
float angle
The world angle of the body in radians.
const b2Vec2 & GetLocalCenter() const
Get the local position of the center of mass.
bool collideConnected
Set this flag to true if the attached bodies should collide.
GLFWwindow * g_mainWindow
void Step(Settings &settings) override
void SetAsBox(float hx, float hy)
float density
The density, usually in kg/m^2.
b2Vec2 localAnchorB
The local anchor point relative to bodyB's origin.
b2Body * CreateBody(const b2BodyDef *def)
int RegisterTest(const char *category, const char *name, TestCreateFcn *fcn)
float maxTorque
The maximum friction torque in N-m.
virtual void Step(Settings &settings)
b2Vec2 GetWorldPoint(const b2Vec2 &localPoint) const
b2Vec2 localAnchorA
The local anchor point relative to bodyA's origin.
b2Body * bodyA
The first attached body.
b2Fixture * CreateFixture(const b2FixtureDef *def)
b2Body * bodyB
The second attached body.
mvsim
Author(s):
autogenerated on Wed May 28 2025 02:13:06