Box2D 3.0.0
A 2D physics engine for games
Loading...
Searching...
No Matches
box2d.h
1// SPDX-FileCopyrightText: 2023 Erin Catto
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
6#include "base.h"
7#include "collision.h"
8#include "id.h"
9#include "types.h"
10
11#include <stdbool.h>
12
28
30B2_API void b2DestroyWorld(b2WorldId worldId);
31
33B2_API bool b2World_IsValid(b2WorldId id);
34
39B2_API void b2World_Step(b2WorldId worldId, float timeStep, int subStepCount);
40
42B2_API void b2World_Draw(b2WorldId worldId, b2DebugDraw* draw);
43
46
49
52
54B2_API void b2World_OverlapAABB(b2WorldId worldId, b2AABB aabb, b2QueryFilter filter, b2OverlapResultFcn* fcn, void* context);
55
57B2_API void b2World_OverlapCircle(b2WorldId worldId, const b2Circle* circle, b2Transform transform, b2QueryFilter filter,
58 b2OverlapResultFcn* fcn, void* context);
59
61B2_API void b2World_OverlapCapsule(b2WorldId worldId, const b2Capsule* capsule, b2Transform transform, b2QueryFilter filter,
62 b2OverlapResultFcn* fcn, void* context);
63
65B2_API void b2World_OverlapPolygon(b2WorldId worldId, const b2Polygon* polygon, b2Transform transform, b2QueryFilter filter,
66 b2OverlapResultFcn* fcn, void* context);
67
78B2_API void b2World_CastRay(b2WorldId worldId, b2Vec2 origin, b2Vec2 translation, b2QueryFilter filter, b2CastResultFcn* fcn,
79 void* context);
80
83B2_API b2RayResult b2World_CastRayClosest(b2WorldId worldId, b2Vec2 origin, b2Vec2 translation, b2QueryFilter filter);
84
86B2_API void b2World_CastCircle(b2WorldId worldId, const b2Circle* circle, b2Transform originTransform, b2Vec2 translation,
87 b2QueryFilter filter, b2CastResultFcn* fcn, void* context);
88
90B2_API void b2World_CastCapsule(b2WorldId worldId, const b2Capsule* capsule, b2Transform originTransform, b2Vec2 translation,
91 b2QueryFilter filter, b2CastResultFcn* fcn, void* context);
92
94B2_API void b2World_CastPolygon(b2WorldId worldId, const b2Polygon* polygon, b2Transform originTransform, b2Vec2 translation,
95 b2QueryFilter filter, b2CastResultFcn* fcn, void* context);
96
100B2_API void b2World_EnableSleeping(b2WorldId worldId, bool flag);
101
106B2_API void b2World_EnableContinuous(b2WorldId worldId, bool flag);
107
111B2_API void b2World_SetRestitutionThreshold(b2WorldId worldId, float value);
112
116B2_API void b2World_SetHitEventThreshold(b2WorldId worldId, float value);
117
119B2_API void b2World_SetCustomFilterCallback(b2WorldId worldId, b2CustomFilterFcn* fcn, void* context);
120
122B2_API void b2World_SetPreSolveCallback(b2WorldId worldId, b2PreSolveFcn* fcn, void* context);
123
127B2_API void b2World_SetGravity(b2WorldId worldId, b2Vec2 gravity);
128
131
137B2_API void b2World_Explode(b2WorldId worldId, b2Vec2 position, float radius, float impulse);
138
145B2_API void b2World_SetContactTuning(b2WorldId worldId, float hertz, float dampingRatio, float pushVelocity);
146
149B2_API void b2World_EnableWarmStarting(b2WorldId worldId, bool flag);
150
152B2_API b2Profile b2World_GetProfile(b2WorldId worldId);
153
155B2_API b2Counters b2World_GetCounters(b2WorldId worldId);
156
159
175B2_API b2BodyId b2CreateBody(b2WorldId worldId, const b2BodyDef* def);
176
179B2_API void b2DestroyBody(b2BodyId bodyId);
180
182B2_API bool b2Body_IsValid(b2BodyId id);
183
186
189B2_API void b2Body_SetType(b2BodyId bodyId, b2BodyType type);
190
192B2_API void b2Body_SetUserData(b2BodyId bodyId, void* userData);
193
195B2_API void* b2Body_GetUserData(b2BodyId bodyId);
196
199
202
204B2_API float b2Body_GetAngle(b2BodyId bodyId);
205
208
212B2_API void b2Body_SetTransform(b2BodyId bodyId, b2Vec2 position, float angle);
213
215B2_API b2Vec2 b2Body_GetLocalPoint(b2BodyId bodyId, b2Vec2 worldPoint);
216
218B2_API b2Vec2 b2Body_GetWorldPoint(b2BodyId bodyId, b2Vec2 localPoint);
219
221B2_API b2Vec2 b2Body_GetLocalVector(b2BodyId bodyId, b2Vec2 worldVector);
222
224B2_API b2Vec2 b2Body_GetWorldVector(b2BodyId bodyId, b2Vec2 localVector);
225
228
231
233B2_API void b2Body_SetLinearVelocity(b2BodyId bodyId, b2Vec2 linearVelocity);
234
236B2_API void b2Body_SetAngularVelocity(b2BodyId bodyId, float angularVelocity);
237
245B2_API void b2Body_ApplyForce(b2BodyId bodyId, b2Vec2 force, b2Vec2 point, bool wake);
246
252B2_API void b2Body_ApplyForceToCenter(b2BodyId bodyId, b2Vec2 force, bool wake);
253
259B2_API void b2Body_ApplyTorque(b2BodyId bodyId, float torque, bool wake);
260
271B2_API void b2Body_ApplyLinearImpulse(b2BodyId bodyId, b2Vec2 impulse, b2Vec2 point, bool wake);
272
280B2_API void b2Body_ApplyLinearImpulseToCenter(b2BodyId bodyId, b2Vec2 impulse, bool wake);
281
289B2_API void b2Body_ApplyAngularImpulse(b2BodyId bodyId, float impulse, bool wake);
290
292B2_API float b2Body_GetMass(b2BodyId bodyId);
293
296
299
302
306B2_API void b2Body_SetMassData(b2BodyId bodyId, b2MassData massData);
307
310
317
320B2_API void b2Body_SetAutomaticMass(b2BodyId bodyId, bool automaticMass);
321
324
326B2_API void b2Body_SetLinearDamping(b2BodyId bodyId, float linearDamping);
327
330
332B2_API void b2Body_SetAngularDamping(b2BodyId bodyId, float angularDamping);
333
336
339B2_API void b2Body_SetGravityScale(b2BodyId bodyId, float gravityScale);
340
342B2_API float b2Body_GetGravityScale(b2BodyId bodyId);
343
345B2_API bool b2Body_IsAwake(b2BodyId bodyId);
346
350B2_API void b2Body_SetAwake(b2BodyId bodyId, bool awake);
351
353B2_API void b2Body_EnableSleep(b2BodyId bodyId, bool enableSleep);
354
356B2_API bool b2Body_IsSleepEnabled(b2BodyId bodyId);
357
359B2_API void b2Body_SetSleepThreshold(b2BodyId bodyId, float sleepVelocity);
360
363
365B2_API bool b2Body_IsEnabled(b2BodyId bodyId);
366
368B2_API void b2Body_Disable(b2BodyId bodyId);
369
371B2_API void b2Body_Enable(b2BodyId bodyId);
372
374B2_API void b2Body_SetFixedRotation(b2BodyId bodyId, bool flag);
375
378
381B2_API void b2Body_SetBullet(b2BodyId bodyId, bool flag);
382
384B2_API bool b2Body_IsBullet(b2BodyId bodyId);
385
388B2_API void b2Body_EnableHitEvents(b2BodyId bodyId, bool enableHitEvents);
389
392
395B2_API int b2Body_GetShapes(b2BodyId bodyId, b2ShapeId* shapeArray, int capacity);
396
399
402B2_API int b2Body_GetJoints(b2BodyId bodyId, b2JointId* jointArray, int capacity);
403
406
408B2_API int b2Body_GetContactData(b2BodyId bodyId, b2ContactData* contactData, int capacity);
409
413
426B2_API b2ShapeId b2CreateCircleShape(b2BodyId bodyId, const b2ShapeDef* def, const b2Circle* circle);
427
431B2_API b2ShapeId b2CreateSegmentShape(b2BodyId bodyId, const b2ShapeDef* def, const b2Segment* segment);
432
436B2_API b2ShapeId b2CreateCapsuleShape(b2BodyId bodyId, const b2ShapeDef* def, const b2Capsule* capsule);
437
441B2_API b2ShapeId b2CreatePolygonShape(b2BodyId bodyId, const b2ShapeDef* def, const b2Polygon* polygon);
442
444B2_API void b2DestroyShape(b2ShapeId shapeId);
445
448
451
454
456B2_API bool b2Shape_IsSensor(b2ShapeId shapeId);
457
459B2_API void b2Shape_SetUserData(b2ShapeId shapeId, void* userData);
460
463B2_API void* b2Shape_GetUserData(b2ShapeId shapeId);
464
468B2_API void b2Shape_SetDensity(b2ShapeId shapeId, float density);
469
471B2_API float b2Shape_GetDensity(b2ShapeId shapeId);
472
475B2_API void b2Shape_SetFriction(b2ShapeId shapeId, float friction);
476
478B2_API float b2Shape_GetFriction(b2ShapeId shapeId);
479
482B2_API void b2Shape_SetRestitution(b2ShapeId shapeId, float restitution);
483
485B2_API float b2Shape_GetRestitution(b2ShapeId shapeId);
486
489
492B2_API void b2Shape_SetFilter(b2ShapeId shapeId, b2Filter filter);
493
496B2_API void b2Shape_EnableSensorEvents(b2ShapeId shapeId, bool flag);
497
500
503B2_API void b2Shape_EnableContactEvents(b2ShapeId shapeId, bool flag);
504
507
511B2_API void b2Shape_EnablePreSolveEvents(b2ShapeId shapeId, bool flag);
512
515
518B2_API void b2Shape_EnableHitEvents(b2ShapeId shapeId, bool flag);
519
522
524B2_API bool b2Shape_TestPoint(b2ShapeId shapeId, b2Vec2 point);
525
527B2_API b2CastOutput b2Shape_RayCast(b2ShapeId shapeId, b2Vec2 origin, b2Vec2 translation);
528
531
534
538
541
544
548B2_API void b2Shape_SetCircle(b2ShapeId shapeId, const b2Circle* circle);
549
553B2_API void b2Shape_SetCapsule(b2ShapeId shapeId, const b2Capsule* capsule);
554
556B2_API void b2Shape_SetSegment(b2ShapeId shapeId, const b2Segment* segment);
557
561B2_API void b2Shape_SetPolygon(b2ShapeId shapeId, const b2Polygon* polygon);
562
566
569
571B2_API int b2Shape_GetContactData(b2ShapeId shapeId, b2ContactData* contactData, int capacity);
572
575
578
580
583B2_API b2ChainId b2CreateChain(b2BodyId bodyId, const b2ChainDef* def);
584
586B2_API void b2DestroyChain(b2ChainId chainId);
587
590B2_API void b2Chain_SetFriction(b2ChainId chainId, float friction);
591
594B2_API void b2Chain_SetRestitution(b2ChainId chainId, float restitution);
595
598
608B2_API void b2DestroyJoint(b2JointId jointId);
609
612
615
618
621
624
627
629B2_API void b2Joint_SetCollideConnected(b2JointId jointId, bool shouldCollide);
630
633
635B2_API void b2Joint_SetUserData(b2JointId jointId, void* userData);
636
638B2_API void* b2Joint_GetUserData(b2JointId jointId);
639
641B2_API void b2Joint_WakeBodies(b2JointId jointId);
642
645
648
658
662B2_API void b2DistanceJoint_SetLength(b2JointId jointId, float length);
663
666
668B2_API void b2DistanceJoint_EnableSpring(b2JointId jointId, bool enableSpring);
669
672
674B2_API void b2DistanceJoint_SetSpringHertz(b2JointId jointId, float hertz);
675
677B2_API void b2DistanceJoint_SetSpringDampingRatio(b2JointId jointId, float dampingRatio);
678
681
684
687B2_API void b2DistanceJoint_EnableLimit(b2JointId jointId, bool enableLimit);
688
691
693B2_API void b2DistanceJoint_SetLengthRange(b2JointId jointId, float minLength, float maxLength);
694
697
700
703
705B2_API void b2DistanceJoint_EnableMotor(b2JointId jointId, bool enableMotor);
706
709
711B2_API void b2DistanceJoint_SetMotorSpeed(b2JointId jointId, float motorSpeed);
712
715
717B2_API void b2DistanceJoint_SetMaxMotorForce(b2JointId jointId, float force);
718
721
724
740
742B2_API void b2MotorJoint_SetLinearOffset(b2JointId jointId, b2Vec2 linearOffset);
743
746
748B2_API void b2MotorJoint_SetAngularOffset(b2JointId jointId, float angularOffset);
749
752
754B2_API void b2MotorJoint_SetMaxForce(b2JointId jointId, float maxForce);
755
758
760B2_API void b2MotorJoint_SetMaxTorque(b2JointId jointId, float maxTorque);
761
764
766B2_API void b2MotorJoint_SetCorrectionFactor(b2JointId jointId, float correctionFactor);
767
770
785
787B2_API void b2MouseJoint_SetTarget(b2JointId jointId, b2Vec2 target);
788
791
793B2_API void b2MouseJoint_SetSpringHertz(b2JointId jointId, float hertz);
794
797
799B2_API void b2MouseJoint_SetSpringDampingRatio(b2JointId jointId, float dampingRatio);
800
803
805B2_API void b2MouseJoint_SetMaxForce(b2JointId jointId, float maxForce);
806
809
824
826B2_API void b2PrismaticJoint_EnableSpring(b2JointId jointId, bool enableSpring);
827
830
834B2_API void b2PrismaticJoint_SetSpringHertz(b2JointId jointId, float hertz);
835
838
840B2_API void b2PrismaticJoint_SetSpringDampingRatio(b2JointId jointId, float dampingRatio);
841
844
846B2_API void b2PrismaticJoint_EnableLimit(b2JointId jointId, bool enableLimit);
847
850
853
856
858B2_API void b2PrismaticJoint_SetLimits(b2JointId jointId, float lower, float upper);
859
861B2_API void b2PrismaticJoint_EnableMotor(b2JointId jointId, bool enableMotor);
862
865
867B2_API void b2PrismaticJoint_SetMotorSpeed(b2JointId jointId, float motorSpeed);
868
871
873B2_API void b2PrismaticJoint_SetMaxMotorForce(b2JointId jointId, float force);
874
877
880
895
897B2_API void b2RevoluteJoint_EnableSpring(b2JointId jointId, bool enableSpring);
898
901
903B2_API void b2RevoluteJoint_SetSpringHertz(b2JointId jointId, float hertz);
904
907
909B2_API void b2RevoluteJoint_SetSpringDampingRatio(b2JointId jointId, float dampingRatio);
910
913
917
919B2_API void b2RevoluteJoint_EnableLimit(b2JointId jointId, bool enableLimit);
920
922B2_API bool b2RevoluteJoint_IsLimitEnabled(b2JointId jointId);
923
926
929
931B2_API void b2RevoluteJoint_SetLimits(b2JointId jointId, float lower, float upper);
932
934B2_API void b2RevoluteJoint_EnableMotor(b2JointId jointId, bool enableMotor);
935
938
940B2_API void b2RevoluteJoint_SetMotorSpeed(b2JointId jointId, float motorSpeed);
941
944
947
949B2_API void b2RevoluteJoint_SetMaxMotorTorque(b2JointId jointId, float torque);
950
953
970
972B2_API void b2WeldJoint_SetLinearHertz(b2JointId jointId, float hertz);
973
976
978B2_API void b2WeldJoint_SetLinearDampingRatio(b2JointId jointId, float dampingRatio);
979
982
984B2_API void b2WeldJoint_SetAngularHertz(b2JointId jointId, float hertz);
985
988
990B2_API void b2WeldJoint_SetAngularDampingRatio(b2JointId jointId, float dampingRatio);
991
994
1010
1012B2_API void b2WheelJoint_EnableSpring(b2JointId jointId, bool enableSpring);
1013
1016
1018B2_API void b2WheelJoint_SetSpringHertz(b2JointId jointId, float hertz);
1019
1022
1024B2_API void b2WheelJoint_SetSpringDampingRatio(b2JointId jointId, float dampingRatio);
1025
1028
1030B2_API void b2WheelJoint_EnableLimit(b2JointId jointId, bool enableLimit);
1031
1034
1037
1040
1042B2_API void b2WheelJoint_SetLimits(b2JointId jointId, float lower, float upper);
1043
1045B2_API void b2WheelJoint_EnableMotor(b2JointId jointId, bool enableMotor);
1046
1049
1051B2_API void b2WheelJoint_SetMotorSpeed(b2JointId jointId, float motorSpeed);
1052
1055
1057B2_API void b2WheelJoint_SetMaxMotorTorque(b2JointId jointId, float torque);
1058
1061
1064
b2Vec2 b2Body_GetWorldCenterOfMass(b2BodyId bodyId)
Get the center of mass position of the body in world space.
bool b2Body_IsSleepEnabled(b2BodyId bodyId)
Returns true if sleeping is enabled for this body.
float b2Body_GetAngle(b2BodyId bodyId)
Get the body angle in radians in the range [-pi, pi].
b2Transform b2Body_GetTransform(b2BodyId bodyId)
Get the world transform of a body.
void b2Body_Enable(b2BodyId bodyId)
Enable a body by adding it to the simulation. This is expensive.
void b2Body_SetAngularVelocity(b2BodyId bodyId, float angularVelocity)
Set the angular velocity of a body in radians per second.
float b2Body_GetSleepThreshold(b2BodyId bodyId)
Get the sleep threshold, typically in meters per second.
void * b2Body_GetUserData(b2BodyId bodyId)
Get the user data stored in a body.
bool b2Body_IsBullet(b2BodyId bodyId)
Is this body a bullet?
void b2Body_ApplyForceToCenter(b2BodyId bodyId, b2Vec2 force, bool wake)
Apply a force to the center of mass.
bool b2Body_IsFixedRotation(b2BodyId bodyId)
Does this body have fixed rotation?
b2Vec2 b2Body_GetLocalCenterOfMass(b2BodyId bodyId)
Get the center of mass position of the body in local space.
void b2Body_SetAutomaticMass(b2BodyId bodyId, bool automaticMass)
Set the automatic mass setting.
void b2Body_SetFixedRotation(b2BodyId bodyId, bool flag)
Set this body to have fixed rotation. This causes the mass to be reset in all cases.
void b2Body_ApplyMassFromShapes(b2BodyId bodyId)
This update the mass properties to the sum of the mass properties of the shapes.
int b2Body_GetShapes(b2BodyId bodyId, b2ShapeId *shapeArray, int capacity)
Get the shape ids for all shapes on this body, up to the provided capacity.
void b2Body_SetGravityScale(b2BodyId bodyId, float gravityScale)
Adjust the gravity scale.
void b2Body_ApplyLinearImpulse(b2BodyId bodyId, b2Vec2 impulse, b2Vec2 point, bool wake)
Apply an impulse at a point.
float b2Body_GetMass(b2BodyId bodyId)
Get the mass of the body, typically in kilograms.
void b2Body_ApplyLinearImpulseToCenter(b2BodyId bodyId, b2Vec2 impulse, bool wake)
Apply an impulse to the center of mass.
void b2Body_ApplyTorque(b2BodyId bodyId, float torque, bool wake)
Apply a torque.
bool b2Body_IsAwake(b2BodyId bodyId)
int b2Body_GetShapeCount(b2BodyId bodyId)
Get the number of shapes on this body.
void b2Body_EnableSleep(b2BodyId bodyId, bool enableSleep)
Enable or disable sleeping for this body. If sleeping is disabled the body will wake.
b2Rot b2Body_GetRotation(b2BodyId bodyId)
Get the world rotation of a body as a cosine/sine pair (complex number)
void b2Body_SetSleepThreshold(b2BodyId bodyId, float sleepVelocity)
Set the sleep threshold, typically in meters per second.
float b2Body_GetLinearDamping(b2BodyId bodyId)
Get the current linear damping.
int b2Body_GetJoints(b2BodyId bodyId, b2JointId *jointArray, int capacity)
Get the joint ids for all joints on this body, up to the provided capacity.
b2Vec2 b2Body_GetLinearVelocity(b2BodyId bodyId)
Get the linear velocity of a body's center of mass. Typically in meters per second.
b2BodyType
The body simulation type.
Definition types.h:123
int b2Body_GetContactData(b2BodyId bodyId, b2ContactData *contactData, int capacity)
Get the touching contact data for a body.
void b2Body_Disable(b2BodyId bodyId)
Disable a body by removing it completely from the simulation. This is expensive.
void b2Body_ApplyForce(b2BodyId bodyId, b2Vec2 force, b2Vec2 point, bool wake)
Apply a force at a world point.
b2Vec2 b2Body_GetLocalPoint(b2BodyId bodyId, b2Vec2 worldPoint)
Get a local point on a body given a world point.
b2Vec2 b2Body_GetWorldVector(b2BodyId bodyId, b2Vec2 localVector)
Get a world vector on a body given a local vector.
b2Vec2 b2Body_GetWorldPoint(b2BodyId bodyId, b2Vec2 localPoint)
Get a world point on a body given a local point.
void b2Body_SetTransform(b2BodyId bodyId, b2Vec2 position, float angle)
Set the world transform of a body.
void b2Body_SetType(b2BodyId bodyId, b2BodyType type)
Change the body type.
b2AABB b2Body_ComputeAABB(b2BodyId bodyId)
Get the current world AABB that contains all the attached shapes.
int b2Body_GetJointCount(b2BodyId bodyId)
Get the number of joints on this body.
void b2Body_SetMassData(b2BodyId bodyId, b2MassData massData)
Override the body's mass properties.
void b2Body_ApplyAngularImpulse(b2BodyId bodyId, float impulse, bool wake)
Apply an angular impulse.
float b2Body_GetAngularDamping(b2BodyId bodyId)
Get the current angular damping.
float b2Body_GetInertiaTensor(b2BodyId bodyId)
Get the inertia tensor of the body, typically in kg*m^2.
float b2Body_GetGravityScale(b2BodyId bodyId)
Get the current gravity scale.
void b2Body_SetLinearDamping(b2BodyId bodyId, float linearDamping)
Adjust the linear damping. Normally this is set in b2BodyDef before creation.
void b2Body_EnableHitEvents(b2BodyId bodyId, bool enableHitEvents)
Enable/disable hit events on all shapes.
void b2Body_SetBullet(b2BodyId bodyId, bool flag)
Set this body to be a bullet.
void b2Body_SetAwake(b2BodyId bodyId, bool awake)
Wake a body from sleep.
b2Vec2 b2Body_GetLocalVector(b2BodyId bodyId, b2Vec2 worldVector)
Get a local vector on a body given a world vector.
int b2Body_GetContactCapacity(b2BodyId bodyId)
Get the maximum capacity required for retrieving all the touching contacts on a body.
b2Vec2 b2Body_GetPosition(b2BodyId bodyId)
Get the world position of a body. This is the location of the body origin.
bool b2Body_GetAutomaticMass(b2BodyId bodyId)
Get the automatic mass setting.
void b2Body_SetAngularDamping(b2BodyId bodyId, float angularDamping)
Adjust the angular damping. Normally this is set in b2BodyDef before creation.
b2BodyId b2CreateBody(b2WorldId worldId, const b2BodyDef *def)
Create a rigid body given a definition.
float b2Body_GetAngularVelocity(b2BodyId bodyId)
Get the angular velocity of a body in radians per second.
b2MassData b2Body_GetMassData(b2BodyId bodyId)
Get the mass data for a body.
void b2Body_SetUserData(b2BodyId bodyId, void *userData)
Set the user data for a body.
bool b2Body_IsValid(b2BodyId id)
Body identifier validation. Can be used to detect orphaned ids. Provides validation for up to 64K all...
void b2Body_SetLinearVelocity(b2BodyId bodyId, b2Vec2 linearVelocity)
Set the linear velocity of a body. Typically in meters per second.
void b2DestroyBody(b2BodyId bodyId)
Destroy a rigid body given an id.
b2BodyType b2Body_GetType(b2BodyId bodyId)
Get the body type: static, kinematic, or dynamic.
bool b2Body_IsEnabled(b2BodyId bodyId)
Returns true if this body is enabled.
A body definition holds all the data needed to construct a rigid body.
Definition types.h:143
void b2DistanceJoint_SetSpringDampingRatio(b2JointId jointId, float dampingRatio)
Set the spring damping ratio, non-dimensional.
float b2DistanceJoint_GetMaxMotorForce(b2JointId jointId)
Get the distance joint maximum motor force, typically in newtons.
float b2DistanceJoint_GetMotorSpeed(b2JointId jointId)
Get the distance joint motor speed, typically in meters per second.
void b2DistanceJoint_EnableSpring(b2JointId jointId, bool enableSpring)
Enable/disable the distance joint spring. When disabled the distance joint is rigid.
float b2DistanceJoint_GetHertz(b2JointId jointId)
Get the spring Hertz.
float b2DistanceJoint_GetMinLength(b2JointId jointId)
Get the distance joint minimum length.
void b2DistanceJoint_SetLengthRange(b2JointId jointId, float minLength, float maxLength)
Set the minimum and maximum length parameters of a distance joint.
bool b2DistanceJoint_IsSpringEnabled(b2JointId jointId)
Is the distance joint spring enabled?
void b2DistanceJoint_EnableMotor(b2JointId jointId, bool enableMotor)
Enable/disable the distance joint motor.
void b2DistanceJoint_SetSpringHertz(b2JointId jointId, float hertz)
Set the spring stiffness in Hertz.
void b2DistanceJoint_SetLength(b2JointId jointId, float length)
Set the rest length of a distance joint.
float b2DistanceJoint_GetMaxLength(b2JointId jointId)
Get the distance joint maximum length.
float b2DistanceJoint_GetLength(b2JointId jointId)
Get the rest length of a distance joint.
b2JointId b2CreateDistanceJoint(b2WorldId worldId, const b2DistanceJointDef *def)
Create a distance joint.
float b2DistanceJoint_GetMotorForce(b2JointId jointId)
Get the distance joint current motor force, typically in newtons.
bool b2DistanceJoint_IsLimitEnabled(b2JointId jointId)
Is the distance joint limit enabled?
float b2DistanceJoint_GetCurrentLength(b2JointId jointId)
Get the current length of a distance joint.
void b2DistanceJoint_SetMaxMotorForce(b2JointId jointId, float force)
Set the distance joint maximum motor force, typically in newtons.
bool b2DistanceJoint_IsMotorEnabled(b2JointId jointId)
Is the distance joint motor enabled?
float b2DistanceJoint_GetDampingRatio(b2JointId jointId)
Get the spring damping ratio.
void b2DistanceJoint_SetMotorSpeed(b2JointId jointId, float motorSpeed)
Set the distance joint motor speed, typically in meters per second.
void b2DistanceJoint_EnableLimit(b2JointId jointId, bool enableLimit)
Enable joint limit.
Distance joint definition.
Definition types.h:462
Body events are buffered in the Box2D world and are available as event arrays after the time step is ...
Definition types.h:996
The contact data for two shapes.
Definition types.h:1008
Contact events are buffered in the Box2D world and are available as event arrays after the time step ...
Definition types.h:954
Sensor events are buffered in the Box2D world and are available as begin/end overlap event arrays aft...
Definition types.h:897
A solid capsule can be viewed as two semicircles connected by a rectangle.
Definition collision.h:111
Low level ray-cast or shape-cast output data.
Definition collision.h:68
A solid circle.
Definition collision.h:100
This holds the mass data computed for a shape.
Definition collision.h:87
A solid convex polygon.
Definition collision.h:129
A line segment with two-sided collision.
Definition collision.h:148
A smooth line segment with one-sided collision.
Definition collision.h:160
Body id references a body instance. This should be treated as an opaque handle.
Definition id.h:44
Chain id references a chain instances. This should be treated as an opaque handle.
Definition id.h:68
Joint id references a joint instance. This should be treated as an opaque handle.
Definition id.h:60
Shape id references a shape instance. This should be treated as an opaque handle.
Definition id.h:52
World id references a world instance. This should be treated as an opaque handle.
Definition id.h:37
b2JointType
Joint type enumeration.
Definition types.h:444
bool b2Joint_IsValid(b2JointId id)
Joint identifier validation. Provides validation for up to 64K allocations.
void b2Joint_SetUserData(b2JointId jointId, void *userData)
Set the user data on a joint.
void b2Joint_WakeBodies(b2JointId jointId)
Wake the bodies connect to this joint.
b2BodyId b2Joint_GetBodyA(b2JointId jointId)
Get body A id on a joint.
bool b2Joint_GetCollideConnected(b2JointId jointId)
Is collision allowed between connected bodies?
void * b2Joint_GetUserData(b2JointId jointId)
Get the user data on a joint.
void b2Joint_SetCollideConnected(b2JointId jointId, bool shouldCollide)
Toggle collision between connected bodies.
b2Vec2 b2Joint_GetLocalAnchorA(b2JointId jointId)
Get the local anchor on bodyA.
b2JointType b2Joint_GetType(b2JointId jointId)
Get the joint type.
float b2Joint_GetConstraintTorque(b2JointId jointId)
Get the current constraint torque for this joint.
b2Vec2 b2Joint_GetConstraintForce(b2JointId jointId)
Get the current constraint force for this joint.
b2Vec2 b2Joint_GetLocalAnchorB(b2JointId jointId)
Get the local anchor on bodyB.
void b2DestroyJoint(b2JointId jointId)
Destroy a joint.
b2BodyId b2Joint_GetBodyB(b2JointId jointId)
Get body B id on a joint.
Axis-aligned bounding box.
Definition math_functions.h:52
2D rotation This is similar to using a complex number for rotation
Definition math_functions.h:31
A 2D rigid transform.
Definition math_functions.h:38
2D vector This can be used to represent a point or free vector
Definition math_functions.h:23
void b2MotorJoint_SetLinearOffset(b2JointId jointId, b2Vec2 linearOffset)
Set the motor joint linear offset target.
b2JointId b2CreateMotorJoint(b2WorldId worldId, const b2MotorJointDef *def)
Create a motor joint.
float b2MotorJoint_GetMaxTorque(b2JointId jointId)
Get the motor joint maximum torque, typically in newton-meters.
b2Vec2 b2MotorJoint_GetLinearOffset(b2JointId jointId)
Get the motor joint linear offset target.
void b2MotorJoint_SetMaxTorque(b2JointId jointId, float maxTorque)
Set the motor joint maximum torque, typically in newton-meters.
void b2MotorJoint_SetAngularOffset(b2JointId jointId, float angularOffset)
Set the motor joint angular offset target in radians.
float b2MotorJoint_GetCorrectionFactor(b2JointId jointId)
Get the motor joint correction factor, typically in [0, 1].
float b2MotorJoint_GetAngularOffset(b2JointId jointId)
Get the motor joint angular offset target in radians.
void b2MotorJoint_SetMaxForce(b2JointId jointId, float maxForce)
Set the motor joint maximum force, typically in newtons.
float b2MotorJoint_GetMaxForce(b2JointId jointId)
Get the motor joint maximum force, typically in newtons.
void b2MotorJoint_SetCorrectionFactor(b2JointId jointId, float correctionFactor)
Set the motor joint correction factor, typically in [0, 1].
A motor joint is used to control the relative motion between two bodies.
Definition types.h:525
float b2MouseJoint_GetMaxForce(b2JointId jointId)
Get the mouse joint maximum force, typically in newtons.
b2JointId b2CreateMouseJoint(b2WorldId worldId, const b2MouseJointDef *def)
Create a mouse joint.
void b2MouseJoint_SetMaxForce(b2JointId jointId, float maxForce)
Set the mouse joint maximum force, typically in newtons.
void b2MouseJoint_SetSpringHertz(b2JointId jointId, float hertz)
Set the mouse joint spring stiffness in Hertz.
float b2MouseJoint_GetSpringDampingRatio(b2JointId jointId)
Get the mouse joint damping ratio, non-dimensional.
void b2MouseJoint_SetSpringDampingRatio(b2JointId jointId, float dampingRatio)
Set the mouse joint spring damping ratio, non-dimensional.
b2Vec2 b2MouseJoint_GetTarget(b2JointId jointId)
Get the mouse joint target.
float b2MouseJoint_GetSpringHertz(b2JointId jointId)
Get the mouse joint spring stiffness in Hertz.
void b2MouseJoint_SetTarget(b2JointId jointId, b2Vec2 target)
Set the mouse joint target.
A mouse joint is used to make a point on a body track a specified world point.
Definition types.h:567
float b2PrismaticJoint_GetMotorSpeed(b2JointId jointId)
Get the prismatic joint motor speed, typically in meters per second.
float b2PrismaticJoint_GetSpringHertz(b2JointId jointId)
Get the prismatic joint stiffness in Hertz.
float b2PrismaticJoint_GetMaxMotorForce(b2JointId jointId)
Get the prismatic joint maximum motor force, typically in newtons.
void b2PrismaticJoint_SetLimits(b2JointId jointId, float lower, float upper)
Set the prismatic joint limits.
float b2PrismaticJoint_GetUpperLimit(b2JointId jointId)
Get the prismatic joint upper limit.
void b2PrismaticJoint_SetMaxMotorForce(b2JointId jointId, float force)
Set the prismatic joint maximum motor force, typically in newtons.
void b2PrismaticJoint_SetSpringHertz(b2JointId jointId, float hertz)
Set the prismatic joint stiffness in Hertz.
b2JointId b2CreatePrismaticJoint(b2WorldId worldId, const b2PrismaticJointDef *def)
Create a prismatic (slider) joint.
void b2PrismaticJoint_EnableSpring(b2JointId jointId, bool enableSpring)
Enable/disable the joint spring.
bool b2PrismaticJoint_IsSpringEnabled(b2JointId jointId)
Is the prismatic joint spring enabled or not?
void b2PrismaticJoint_EnableMotor(b2JointId jointId, bool enableMotor)
Enable/disable a prismatic joint motor.
void b2PrismaticJoint_SetMotorSpeed(b2JointId jointId, float motorSpeed)
Set the prismatic joint motor speed, typically in meters per second.
bool b2PrismaticJoint_IsMotorEnabled(b2JointId jointId)
Is the prismatic joint motor enabled?
void b2PrismaticJoint_EnableLimit(b2JointId jointId, bool enableLimit)
Enable/disable a prismatic joint limit.
float b2PrismaticJoint_GetMotorForce(b2JointId jointId)
Get the prismatic joint current motor force, typically in newtons.
void b2PrismaticJoint_SetSpringDampingRatio(b2JointId jointId, float dampingRatio)
Set the prismatic joint damping ratio (non-dimensional)
bool b2PrismaticJoint_IsLimitEnabled(b2JointId jointId)
Is the prismatic joint limit enabled?
float b2PrismaticJoint_GetLowerLimit(b2JointId jointId)
Get the prismatic joint lower limit.
float b2PrismaticJoint_GetSpringDampingRatio(b2JointId jointId)
Get the prismatic spring damping ratio (non-dimensional)
Prismatic joint definition.
Definition types.h:608
void b2RevoluteJoint_SetMaxMotorTorque(b2JointId jointId, float torque)
Set the revolute joint maximum motor torque, typically in newton-meters.
void b2RevoluteJoint_SetLimits(b2JointId jointId, float lower, float upper)
Set the revolute joint limits in radians.
float b2RevoluteJoint_GetSpringDampingRatio(b2JointId jointId)
Get the revolute joint spring damping ratio, non-dimensional.
float b2RevoluteJoint_GetMaxMotorTorque(b2JointId jointId)
Get the revolute joint maximum motor torque, typically in newton-meters.
bool b2RevoluteJoint_IsMotorEnabled(b2JointId jointId)
Is the revolute joint motor enabled?
float b2RevoluteJoint_GetMotorTorque(b2JointId jointId)
Get the revolute joint current motor torque, typically in newton-meters.
bool b2RevoluteJoint_IsLimitEnabled(b2JointId jointId)
Is the revolute joint limit enabled?
float b2RevoluteJoint_GetLowerLimit(b2JointId jointId)
Get the revolute joint lower limit in radians.
float b2RevoluteJoint_GetMotorSpeed(b2JointId jointId)
Get the revolute joint motor speed in radians per second.
b2JointId b2CreateRevoluteJoint(b2WorldId worldId, const b2RevoluteJointDef *def)
Create a revolute joint.
void b2RevoluteJoint_SetSpringDampingRatio(b2JointId jointId, float dampingRatio)
Set the revolute joint spring damping ratio, non-dimensional.
float b2RevoluteJoint_GetAngle(b2JointId jointId)
Get the revolute joint current angle in radians relative to the reference angle.
float b2RevoluteJoint_GetSpringHertz(b2JointId jointId)
Get the revolute joint spring stiffness in Hertz.
void b2RevoluteJoint_SetSpringHertz(b2JointId jointId, float hertz)
Set the revolute joint spring stiffness in Hertz.
void b2RevoluteJoint_EnableMotor(b2JointId jointId, bool enableMotor)
Enable/disable a revolute joint motor.
void b2RevoluteJoint_EnableLimit(b2JointId jointId, bool enableLimit)
Enable/disable the revolute joint limit.
float b2RevoluteJoint_GetUpperLimit(b2JointId jointId)
Get the revolute joint upper limit in radians.
void b2RevoluteJoint_SetMotorSpeed(b2JointId jointId, float motorSpeed)
Set the revolute joint motor speed in radians per second.
void b2RevoluteJoint_EnableSpring(b2JointId jointId, bool enableSpring)
Enable/disable the revolute joint spring.
Revolute joint definition.
Definition types.h:681
b2BodyId b2Shape_GetBody(b2ShapeId shapeId)
Get the id of the body that a shape is attached to.
void b2Shape_SetFriction(b2ShapeId shapeId, float friction)
Set the friction on a shape.
b2Capsule b2Shape_GetCapsule(b2ShapeId shapeId)
Get a copy of the shape's capsule. Asserts the type is correct.
b2Vec2 b2Shape_GetClosestPoint(b2ShapeId shapeId, b2Vec2 target)
Get the closest point on a shape to a target point. Target and result are in world space.
void b2Shape_SetFilter(b2ShapeId shapeId, b2Filter filter)
Set the current filter.
b2ShapeId b2CreateCircleShape(b2BodyId bodyId, const b2ShapeDef *def, const b2Circle *circle)
Create a circle shape and attach it to a body.
void b2Chain_SetRestitution(b2ChainId chainId, float restitution)
Set the chain restitution (bounciness)
bool b2Shape_ArePreSolveEventsEnabled(b2ShapeId shapeId)
Returns true if pre-solve events are enabled.
b2CastOutput b2Shape_RayCast(b2ShapeId shapeId, b2Vec2 origin, b2Vec2 translation)
Ray cast a shape directly.
float b2Shape_GetDensity(b2ShapeId shapeId)
Get the density of a shape, typically in kg/m^2.
void b2Shape_SetSegment(b2ShapeId shapeId, const b2Segment *segment)
Allows you to change a shape to be a segment or update the current segment.
b2ShapeType b2Shape_GetType(b2ShapeId shapeId)
Get the type of a shape.
void b2Shape_SetUserData(b2ShapeId shapeId, void *userData)
Set the user data for a shape.
void b2Shape_SetDensity(b2ShapeId shapeId, float density)
Set the mass density of a shape, typically in kg/m^2.
b2ChainId b2Shape_GetParentChain(b2ShapeId shapeId)
Get the parent chain id if the shape type is b2_smoothSegmentShape, otherwise returns b2_nullChainId.
void b2DestroyShape(b2ShapeId shapeId)
Destroy a shape.
void b2Shape_EnableHitEvents(b2ShapeId shapeId, bool flag)
Enable contact hit events for this shape.
b2Circle b2Shape_GetCircle(b2ShapeId shapeId)
Get a copy of the shape's circle. Asserts the type is correct.
bool b2Shape_IsSensor(b2ShapeId shapeId)
Returns true If the shape is a sensor.
b2ShapeType
Shape type.
Definition types.h:275
b2ShapeId b2CreateCapsuleShape(b2BodyId bodyId, const b2ShapeDef *def, const b2Capsule *capsule)
Create a capsule shape and attach it to a body.
void b2Shape_EnableSensorEvents(b2ShapeId shapeId, bool flag)
Enable sensor events for this shape.
bool b2Shape_TestPoint(b2ShapeId shapeId, b2Vec2 point)
Test a point for overlap with a shape.
int b2Shape_GetContactCapacity(b2ShapeId shapeId)
Get the maximum capacity required for retrieving all the touching contacts on a shape.
void b2Shape_SetCircle(b2ShapeId shapeId, const b2Circle *circle)
Allows you to change a shape to be a circle or update the current circle.
void b2Shape_SetCapsule(b2ShapeId shapeId, const b2Capsule *capsule)
Allows you to change a shape to be a capsule or update the current capsule.
b2AABB b2Shape_GetAABB(b2ShapeId shapeId)
Get the current world AABB.
bool b2Shape_AreContactEventsEnabled(b2ShapeId shapeId)
Returns true if contact events are enabled.
void * b2Shape_GetUserData(b2ShapeId shapeId)
Get the user data for a shape.
void b2Shape_SetPolygon(b2ShapeId shapeId, const b2Polygon *polygon)
Allows you to change a shape to be a polygon or update the current polygon.
void b2DestroyChain(b2ChainId chainId)
Destroy a chain shape.
b2ShapeId b2CreatePolygonShape(b2BodyId bodyId, const b2ShapeDef *def, const b2Polygon *polygon)
Create a polygon shape and attach it to a body.
b2Polygon b2Shape_GetPolygon(b2ShapeId shapeId)
Get a copy of the shape's convex polygon. Asserts the type is correct.
float b2Shape_GetFriction(b2ShapeId shapeId)
Get the friction of a shape.
float b2Shape_GetRestitution(b2ShapeId shapeId)
Get the shape restitution.
bool b2Shape_AreSensorEventsEnabled(b2ShapeId shapeId)
Returns true if sensor events are enabled.
bool b2Chain_IsValid(b2ChainId id)
Chain identifier validation. Provides validation for up to 64K allocations.
int b2Shape_GetContactData(b2ShapeId shapeId, b2ContactData *contactData, int capacity)
Get the touching contact data for a shape. The provided shapeId will be either shapeIdA or shapeIdB o...
bool b2Shape_AreHitEventsEnabled(b2ShapeId shapeId)
Returns true if hit events are enabled.
void b2Shape_EnableContactEvents(b2ShapeId shapeId, bool flag)
Enable contact events for this shape.
b2SmoothSegment b2Shape_GetSmoothSegment(b2ShapeId shapeId)
Get a copy of the shape's smooth line segment.
b2Filter b2Shape_GetFilter(b2ShapeId shapeId)
Get the shape filter.
b2ChainId b2CreateChain(b2BodyId bodyId, const b2ChainDef *def)
Chain Shape.
b2ShapeId b2CreateSegmentShape(b2BodyId bodyId, const b2ShapeDef *def, const b2Segment *segment)
Create a line segment shape and attach it to a body.
b2Segment b2Shape_GetSegment(b2ShapeId shapeId)
Get a copy of the shape's line segment. Asserts the type is correct.
bool b2Shape_IsValid(b2ShapeId id)
Shape identifier validation. Provides validation for up to 64K allocations.
void b2Chain_SetFriction(b2ChainId chainId, float friction)
Set the chain friction.
void b2Shape_SetRestitution(b2ShapeId shapeId, float restitution)
Set the shape restitution (bounciness)
void b2Shape_EnablePreSolveEvents(b2ShapeId shapeId, bool flag)
Enable pre-solve contact events for this shape.
Used to create a chain of edges.
Definition types.h:362
This is used to filter collision on shapes.
Definition types.h:217
The query filter is used to filter collisions between queries and shapes.
Definition types.h:259
Used to create a shape.
Definition types.h:301
void b2WeldJoint_SetLinearDampingRatio(b2JointId jointId, float dampingRatio)
Set the weld joint linear damping ratio (non-dimensional)
void b2WeldJoint_SetAngularDampingRatio(b2JointId jointId, float dampingRatio)
Set weld joint angular damping ratio, non-dimensional.
float b2WeldJoint_GetLinearHertz(b2JointId jointId)
Get the weld joint linear stiffness in Hertz.
b2JointId b2CreateWeldJoint(b2WorldId worldId, const b2WeldJointDef *def)
Create a weld joint.
float b2WeldJoint_GetLinearDampingRatio(b2JointId jointId)
Get the weld joint linear damping ratio (non-dimensional)
float b2WeldJoint_GetAngularHertz(b2JointId jointId)
Get the weld joint angular stiffness in Hertz.
float b2WeldJoint_GetAngularDampingRatio(b2JointId jointId)
Get the weld joint angular damping ratio, non-dimensional.
void b2WeldJoint_SetAngularHertz(b2JointId jointId, float hertz)
Set the weld joint angular stiffness in Hertz. 0 is rigid.
void b2WeldJoint_SetLinearHertz(b2JointId jointId, float hertz)
Set the weld joint linear stiffness in Hertz. 0 is rigid.
Weld joint definition.
Definition types.h:749
void b2WheelJoint_SetMaxMotorTorque(b2JointId jointId, float torque)
Set the wheel joint maximum motor torque, typically in newton-meters.
bool b2WheelJoint_IsSpringEnabled(b2JointId jointId)
Is the wheel joint spring enabled?
float b2WheelJoint_GetUpperLimit(b2JointId jointId)
Get the wheel joint upper limit.
void b2WheelJoint_SetLimits(b2JointId jointId, float lower, float upper)
Set the wheel joint limits.
bool b2WheelJoint_IsMotorEnabled(b2JointId jointId)
Is the wheel joint motor enabled?
bool b2WheelJoint_IsLimitEnabled(b2JointId jointId)
Is the wheel joint limit enabled?
void b2WheelJoint_SetSpringHertz(b2JointId jointId, float hertz)
Set the wheel joint stiffness in Hertz.
float b2WheelJoint_GetSpringHertz(b2JointId jointId)
Get the wheel joint stiffness in Hertz.
void b2WheelJoint_EnableLimit(b2JointId jointId, bool enableLimit)
Enable/disable the wheel joint limit.
void b2WheelJoint_EnableSpring(b2JointId jointId, bool enableSpring)
Enable/disable the wheel joint spring.
float b2WheelJoint_GetSpringDampingRatio(b2JointId jointId)
Get the wheel joint damping ratio, non-dimensional.
float b2WheelJoint_GetLowerLimit(b2JointId jointId)
Get the wheel joint lower limit.
void b2WheelJoint_EnableMotor(b2JointId jointId, bool enableMotor)
Enable/disable the wheel joint motor.
b2JointId b2CreateWheelJoint(b2WorldId worldId, const b2WheelJointDef *def)
Create a wheel joint.
float b2WheelJoint_GetMotorSpeed(b2JointId jointId)
Get the wheel joint motor speed in radians per second.
float b2WheelJoint_GetMotorTorque(b2JointId jointId)
Get the wheel joint current motor torque, typically in newton-meters.
void b2WheelJoint_SetSpringDampingRatio(b2JointId jointId, float dampingRatio)
Set the wheel joint damping ratio, non-dimensional.
void b2WheelJoint_SetMotorSpeed(b2JointId jointId, float motorSpeed)
Set the wheel joint motor speed in radians per second.
float b2WheelJoint_GetMaxMotorTorque(b2JointId jointId)
Get the wheel joint maximum motor torque, typically in newton-meters.
Wheel joint definition.
Definition types.h:799
void b2World_Step(b2WorldId worldId, float timeStep, int subStepCount)
Simulate a world for one time step.
void b2World_Draw(b2WorldId worldId, b2DebugDraw *draw)
Call this to draw shapes and other debug draw data.
void b2World_SetContactTuning(b2WorldId worldId, float hertz, float dampingRatio, float pushVelocity)
Adjust contact tuning parameters.
b2RayResult b2World_CastRayClosest(b2WorldId worldId, b2Vec2 origin, b2Vec2 translation, b2QueryFilter filter)
Cast a ray into the world to collect the closest hit.
void b2World_CastCapsule(b2WorldId worldId, const b2Capsule *capsule, b2Transform originTransform, b2Vec2 translation, b2QueryFilter filter, b2CastResultFcn *fcn, void *context)
Cast a capsule through the world. Similar to a cast ray except that a capsule is cast instead of a po...
void b2World_CastPolygon(b2WorldId worldId, const b2Polygon *polygon, b2Transform originTransform, b2Vec2 translation, b2QueryFilter filter, b2CastResultFcn *fcn, void *context)
Cast a polygon through the world. Similar to a cast ray except that a polygon is cast instead of a po...
bool b2OverlapResultFcn(b2ShapeId shapeId, void *context)
Prototype callback for overlap queries.
Definition types.h:1049
void b2World_CastCircle(b2WorldId worldId, const b2Circle *circle, b2Transform originTransform, b2Vec2 translation, b2QueryFilter filter, b2CastResultFcn *fcn, void *context)
Cast a circle through the world. Similar to a cast ray except that a circle is cast instead of a poin...
void b2World_EnableSleeping(b2WorldId worldId, bool flag)
Enable/disable sleep.
void b2World_DumpMemoryStats(b2WorldId worldId)
Dump memory stats to box2d_memory.txt.
void b2World_EnableContinuous(b2WorldId worldId, bool flag)
Enable/disable continuous collision between dynamic and static bodies.
b2WorldId b2CreateWorld(const b2WorldDef *def)
Create a world for rigid body simulation.
b2Profile b2World_GetProfile(b2WorldId worldId)
Get the current world performance profile.
void b2World_OverlapCapsule(b2WorldId worldId, const b2Capsule *capsule, b2Transform transform, b2QueryFilter filter, b2OverlapResultFcn *fcn, void *context)
Overlap test for all shapes that overlap the provided capsule.
void b2World_OverlapCircle(b2WorldId worldId, const b2Circle *circle, b2Transform transform, b2QueryFilter filter, b2OverlapResultFcn *fcn, void *context)
Overlap test for for all shapes that overlap the provided circle.
b2ContactEvents b2World_GetContactEvents(b2WorldId worldId)
Get contact events for this current time step. The event data is transient. Do not store a reference ...
void b2World_EnableWarmStarting(b2WorldId worldId, bool flag)
Enable/disable constraint warm starting.
void b2World_SetGravity(b2WorldId worldId, b2Vec2 gravity)
Set the gravity vector for the entire world.
bool b2World_IsValid(b2WorldId id)
World id validation. Provides validation for up to 64K allocations.
void b2World_SetCustomFilterCallback(b2WorldId worldId, b2CustomFilterFcn *fcn, void *context)
Register the custom filter callback. This is optional.
b2SensorEvents b2World_GetSensorEvents(b2WorldId worldId)
Get sensor events for the current time step. The event data is transient. Do not store a reference to...
void b2DestroyWorld(b2WorldId worldId)
Destroy a world.
void b2World_SetHitEventThreshold(b2WorldId worldId, float value)
Adjust the hit event threshold.
void b2World_Explode(b2WorldId worldId, b2Vec2 position, float radius, float impulse)
Apply a radial explosion.
bool b2PreSolveFcn(b2ShapeId shapeIdA, b2ShapeId shapeIdB, b2Manifold *manifold, void *context)
Prototype for a pre-solve callback.
Definition types.h:1042
void b2World_OverlapAABB(b2WorldId worldId, b2AABB aabb, b2QueryFilter filter, b2OverlapResultFcn *fcn, void *context)
Overlap test for all shapes that potentially overlap the provided AABB.
void b2World_CastRay(b2WorldId worldId, b2Vec2 origin, b2Vec2 translation, b2QueryFilter filter, b2CastResultFcn *fcn, void *context)
Cast a ray into the world to collect shapes in the path of the ray.
void b2World_SetRestitutionThreshold(b2WorldId worldId, float value)
Adjust the restitution threshold.
float b2CastResultFcn(b2ShapeId shapeId, b2Vec2 point, b2Vec2 normal, float fraction, void *context)
Prototype callback for ray casts.
Definition types.h:1066
b2Counters b2World_GetCounters(b2WorldId worldId)
Get world counters and sizes.
b2BodyEvents b2World_GetBodyEvents(b2WorldId worldId)
Get the body events for the current time step. The event data is transient. Do not store a reference ...
void b2World_SetPreSolveCallback(b2WorldId worldId, b2PreSolveFcn *fcn, void *context)
Register the pre-solve callback. This is optional.
void b2World_OverlapPolygon(b2WorldId worldId, const b2Polygon *polygon, b2Transform transform, b2QueryFilter filter, b2OverlapResultFcn *fcn, void *context)
Overlap test for all shapes that overlap the provided polygon.
b2Vec2 b2World_GetGravity(b2WorldId worldId)
Get the gravity vector.
bool b2CustomFilterFcn(b2ShapeId shapeIdA, b2ShapeId shapeIdB, void *context)
Prototype for a contact filter callback.
Definition types.h:1027
Result from b2World_RayCastClosest.
Definition types.h:53
World definition used to create a simulation world.
Definition types.h:65
This struct holds callbacks you can implement to draw a Box2D world.
Definition types.h:1230