Go to the documentation of this file.
29 if (
test->m_mouseJoint == joint)
35 test->JointDestroyed(joint);
42 gravity.
Set(0.0
f, -10.0
f);
98 cp->
state = state2[i];
156 d.Set(0.001
f, 0.001
f);
166 float frequencyHz = 5.0f;
167 float dampingRatio = 0.7f;
195 const float multiplier = 30.0f;
280 float timeStep = settings.
m_hertz > 0.0f ? 1.0f / settings.
m_hertz : float(0.0
f);
364 memset(&aveProfile, 0,
sizeof(
b2Profile));
408 const float k_impulseScale = 0.1f;
409 const float k_axisScale = 0.3f;
bool m_drawContactImpulse
void SetDebugDraw(b2Draw *debugDraw)
float b2Cross(const b2Vec2 &a, const b2Vec2 &b)
Perform the cross product on two vectors. In 2D this produces a scalar.
@ b2_addState
point was added in the update
void ShiftOrigin(const b2Vec2 &newOrigin)
void QueryAABB(b2QueryCallback *callback, const b2AABB &aabb) const
b2BodyType GetType() const
Get the type of this body.
ContactPoint m_points[k_maxContactPoints]
@ b2_persistState
point persisted across the update
void SetSubStepping(bool flag)
Enable/disable single stepped continuous physics. For testing.
int32 GetBodyCount() const
Get the number of bodies.
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.
bool m_drawFrictionImpulse
void ShiftMouseDown(const b2Vec2 &p)
DestructionListener m_destructionListener
float damping
The linear damping in N*s/m.
bool TestPoint(const b2Vec2 &p) const
void DebugDraw()
Call this to draw shapes and other debug draw data. This is intentionally non-const.
void DrawSegment(const b2Vec2 &p1, const b2Vec2 &p2, const b2Color &color) override
Draw a line segment.
A rigid body. These are created via b2World::CreateBody.
void DestroyJoint(b2Joint *joint)
void SetTarget(const b2Vec2 &target)
Use this to update the target point.
void Set(float x_, float y_)
Set this vector to some specified coordinates.
virtual void MouseDown(const b2Vec2 &p)
b2Vec2 upperBound
the upper vertex
const b2Profile & GetProfile() const
Get the current profile.
void SetLinearVelocity(const b2Vec2 &v)
void SayGoodbye(b2Fixture *fixture) override
virtual void MouseMove(const b2Vec2 &p)
bool m_drawContactNormals
void Step(float timeStep, int32 velocityIterations, int32 positionIterations)
bool ReportFixture(b2Fixture *fixture) override
b2PointState
This is used for determining the state of contact points.
int32 GetJointCount() const
Get the number of joints.
b2Vec2 normal
world vector pointing from A to B
b2Vec2 points[b2_maxManifoldPoints]
world contact point (point of intersection)
@ e_centerOfMassBit
draw center of mass frame
int32 pointCount
the number of manifold points
int32 GetProxyCount() const
Get the number of broad-phase proxies.
b2Joint * CreateJoint(const b2JointDef *def)
float restitution
The restitution (elasticity) usually in the range [0,1].
float tangentImpulse
the friction impulse
#define b2_maxManifoldPoints
void DrawString(int x, int y, const char *string,...)
const int32 k_maxContactPoints
void CompleteBombSpawn(const b2Vec2 &p)
int32 GetContactCount() const
Get the number of contacts (each may have 0 or more contact points).
void ShiftOrigin(const b2Vec2 &newOrigin)
bool m_enableWarmStarting
Color for debug drawing. Each value has the range [0,1].
float normalImpulse
the non-penetration impulse
float RandomFloat()
Random number in range [-1,1].
@ e_jointBit
draw joint connections
float density
The density, usually in kg/m^2.
void DrawTitle(const char *string)
B2_API void b2GetPointStates(b2PointState state1[b2_maxManifoldPoints], b2PointState state2[b2_maxManifoldPoints], const b2Manifold *manifold1, const b2Manifold *manifold2)
int32 GetTreeBalance() const
Get the balance of the dynamic tree.
This is used to compute the current state of a contact manifold.
void DrawPoint(const b2Vec2 &p, float size, const b2Color &color) override
Draw a point.
QueryCallback(const b2Vec2 &point)
float stiffness
The linear stiffness in N/m.
TestEntry g_testEntries[MAX_TESTS]
An axis aligned bounding box.
b2Body * CreateBody(const b2BodyDef *def)
void SetWarmStarting(bool flag)
Enable/disable warm starting. For testing.
int RegisterTest(const char *category, const char *name, TestCreateFcn *fcn)
Profiling data. Times are in milliseconds.
void DestroyBody(b2Body *body)
virtual void PreSolve(b2Contact *contact, const b2Manifold *oldManifold) override
@ e_aabbBit
draw axis aligned bounding boxes
void SpawnBomb(const b2Vec2 &worldPt)
void SetContactListener(b2ContactListener *listener)
int32 GetTreeHeight() const
Get the height of the dynamic tree.
float separations[b2_maxManifoldPoints]
a negative value indicates overlap, in meters
b2ManifoldPoint points[b2_maxManifoldPoints]
the points of contact
void SetDestructionListener(b2DestructionListener *listener)
void SetFlags(uint32 flags)
Set the drawing flags.
virtual void Step(Settings &settings)
b2MouseJoint * m_mouseJoint
b2Body * bodyA
The first attached body.
b2Vec2 lowerBound
the lower vertex
void SetAllowSleeping(bool flag)
Enable/disable sleep.
void SetContinuousPhysics(bool flag)
Enable/disable continuous physics. For testing.
void Set(float rIn, float gIn, float bIn, float aIn=1.0f)
virtual void MouseUp(const b2Vec2 &p)
b2Fixture * CreateFixture(const b2FixtureDef *def)
float GetTreeQuality() const
b2Body * bodyB
The second attached body.
mvsim
Author(s):
autogenerated on Wed May 28 2025 02:13:08