20 float const PlatformWidth = 8.0f;
29 float const Angle1Degrees = -30.0f;
30 float const Angle2Degrees = 10.0f;
35 float const SlopeLength = 2.0f;
37 float const SurfaceFriction = 0.2f;
40 float const Slope1Incline = -Angle1Degrees *
b2_pi / 180.0f;
41 float const Slope2Incline = Slope1Incline - Angle2Degrees *
b2_pi / 180.0f;
47 b2Vec2 v1(-PlatformWidth, 0.0
f);
49 b2Vec2 v3(SlopeLength * cosf(Slope1Incline), -SlopeLength * sinf(Slope1Incline));
50 b2Vec2 v4(v3.
x + SlopeLength * cosf(Slope2Incline), v3.
y - SlopeLength * sinf(Slope2Incline));
53 b2Vec2 vertices[5] = { v5, v4, v3, v2, v1 };
66 float const BodyWidth = 1.0f;
67 float const BodyHeight = 2.5f;
68 float const SkiLength = 3.0f;
73 float const SkiThickness = 0.3f;
75 float const SkiFriction = 0.0f;
76 float const SkiRestitution = 0.15f;
81 float initial_y = BodyHeight / 2 + SkiThickness;
88 verts[0].
Set(-SkiLength / 2 - SkiThickness, -BodyHeight / 2);
89 verts[1].
Set(-SkiLength / 2, -BodyHeight / 2 - SkiThickness);
90 verts[2].
Set(SkiLength / 2, -BodyHeight / 2 - SkiThickness);
91 verts[3].
Set(SkiLength / 2 + SkiThickness, -BodyHeight / 2);
b2Fixture * CreateFixture(const b2FixtureDef *def)
float density
The density, usually in kg/m^2.
void Step(Settings &settings) override
const b2Vec2 & GetPosition() const
A rigid body. These are created via b2World::CreateBody.
void SetLinearVelocity(const b2Vec2 &v)
void Set(float x_, float y_)
Set this vector to some specified coordinates.
void CreateLoop(const b2Vec2 *vertices, int32 count)
void Set(const b2Vec2 *points, int32 count)
void Keyboard(int key) override
int RegisterTest(const char *category, const char *name, TestCreateFcn *fcn)
void DrawString(int x, int y, const char *string,...)
virtual void Step(Settings &settings)
float restitution
The restitution (elasticity) usually in the range [0,1].
b2Body * CreateBody(const b2BodyDef *def)
float friction
The friction coefficient, usually in the range [0,1].