Bindings for [[ Box2D ; https://box2d.org ]].

Collection Info

View Source
Collection
vendor
Path
box2d
Entries
598

Source Files

Constants

16

bodyTypeCount #

Source
bodyTypeCount :: len(BodyType)

number of body types

MAX_POLYGON_VERTICES #

Source
MAX_POLYGON_VERTICES :: 8

The maximum number of vertices on a convex polygon. Changing this affects performance even if you don't use more vertices.

nullWorldId #

Source
nullWorldId :: WorldId{}

/ Use these to make your identifiers null. / You may also use zero initialization to get null.

shapeTypeCount #

Source
shapeTypeCount :: len(ShapeType)

The number of shape types

Transform_identity #

Source
Transform_identity :: Transform{{0, 0}, {1, 0}}

Types

92

AllocFcn #

Source
AllocFcn :: AllocFcn

Prototype for user allocation function @param size the allocation size in bytes @param alignment the required alignment, guaranteed to be a power of 2

AssertFcn #

Source
AssertFcn :: AssertFcn

Prototype for the user assert callback. Return 0 to skip the debugger break.

BodyDef #

Source
BodyDef :: BodyDef

A body definition holds all the data needed to construct a rigid body. You can safely re-use body definitions. Shapes are added to a body after construction. Body definitions are temporary objects used to bundle creation parameters. Must be initialized using b2DefaultBodyDef(). @ingroup body

BodyEvents #

Source
BodyEvents :: BodyEvents

Body events are buffered in the Box2D world and are available as event arrays after the time step is complete. Note: this date becomes invalid if bodies are destroyed

BodyId #

Source
BodyId :: BodyId

/ Body id references a body instance. This should be treated as an opaque handle.

BodyMoveEvent #

Source
BodyMoveEvent :: BodyMoveEvent

Body move events triggered when a body moves. Triggered when a body moves due to simulation. Not reported for bodies moved by the user. This also has a flag to indicate that the body went to sleep so the application can also sleep that actor/entity/object associated with the body. On the other hand if the flag does not indicate the body went to sleep then the application can treat the actor/entity/object associated with the body as awake. This is an efficient way for an application to update game object transforms rather than calling functions such as b2Body_GetTransform() because this data is delivered as a contiguous array and it is only populated with bodies that have moved. @note If sleeping is disabled all dynamic and kinematic bodies will trigger move events.

BodyType #

Source
BodyType :: BodyType

The body simulation type. Each body is one of these three types. The type determines how the body behaves in the simulation. @ingroup body

Capsule #

Source
Capsule :: Capsule

A solid capsule can be viewed as two semicircles connected by a rectangle.

CastOutput #

Source
CastOutput :: CastOutput

Low level ray cast or shape-cast output data. Returns a zero fraction and normal in the case of initial overlap.

CastResultFcn #

Source
CastResultFcn :: CastResultFcn

Prototype callback for ray and shape casts. Called for each shape found in the query. You control how the ray cast proceeds by returning a f32: return -1: ignore this shape and continue return 0: terminate the ray cast return fraction: clip the ray to this point return 1: don't clip the ray and continue A cast with initial overlap will return a zero fraction and a zero normal. @param shapeId the shape hit by the ray @param point the point of initial intersection @param normal the normal vector at the point of intersection, zero for a shape cast with initial overlap @param fraction the fraction along the ray at the point of intersection, zero for a shape cast with initial overlap @param context the user context @return -1 to filter, 0 to terminate, fraction to clip the ray for closest hit, 1 to continue @see b2World_CastRay @ingroup world

ChainDef #

Source
ChainDef :: ChainDef

Used to create a chain of line segments. This is designed to eliminate ghost collisions with some limitations. - chains are one-sided - chains have no mass and should be used on static bodies - chains have a counter-clockwise winding order (normal points right of segment direction) - chains are either a loop or open - a chain must have at least 4 points - the distance between any two points must be greater than B2_LINEAR_SLOP - a chain shape should not self intersect (this is not validated) - an open chain shape has NO COLLISION on the first and final edge - you may overlap two open chains on their first three and/or last three points to get smooth collision - a chain shape creates multiple line segment shapes on the body https://en.wikipedia.org/wiki/Polygonal_chain Must be initialized using b2DefaultChainDef(). @warning Do not use chain shapes unless you understand the limitations. This is an advanced feature. @ingroup shape

ChainId #

Source
ChainId :: ChainId

/ Chain id references a chain instances. This should be treated as an opaque handle.

ChainSegment #

Source
ChainSegment :: ChainSegment

A line segment with one-sided collision. Only collides on the right side. Several of these are generated for a chain shape. ghost1 -> point1 -> point2 -> ghost2

CollisionPlane #

Source
CollisionPlane :: CollisionPlane

These are collision planes that can be fed to b2SolvePlanes. Normally this is assembled by the user from plane results in b2PlaneResult

ContactData #

Source
ContactData :: ContactData

The contact data for two shapes. By convention the manifold normal points from shape A to shape B. @see b2Shape_GetContactData() and b2Body_GetContactData()

ContactEndTouchEvent #

Source
ContactEndTouchEvent :: ContactEndTouchEvent

An end touch event is generated when two shapes stop touching. You will get an end event if you do anything that destroys contacts previous to the last world step. These include things like setting the transform, destroying a body or shape, or changing a filter or body type.

ContactEvents #

Source
ContactEvents :: ContactEvents

Contact events are buffered in the Box2D world and are available as event arrays after the time step is complete. Note: these may become invalid if bodies and/or shapes are destroyed

ContactHitEvent #

Source
ContactHitEvent :: ContactHitEvent

A hit touch event is generated when two shapes collide with a speed faster than the hit speed threshold. This may be reported for speculative contacts that have a confirmed impulse.

CosSin #

Source
CosSin :: CosSin

Cosine and sine pair This uses a custom implementation designed for cross-platform determinism

CustomFilterFcn #

Source
CustomFilterFcn :: CustomFilterFcn

Prototype for a contact filter callback. This is called when a contact pair is considered for collision. This allows you to perform custom logic to prevent collision between shapes. This is only called if one of the two shapes has custom filtering enabled. @see b2ShapeDef. Notes: - this function must be thread-safe - this is only called if one of the two shapes has enabled custom filtering - this is called only for awake dynamic bodies Return false if you want to disable the collision @warning Do not attempt to modify the world inside this callback @ingroup world

DebugDraw #

Source
DebugDraw :: DebugDraw

This struct holds callbacks you can implement to draw a Box2D world. @ingroup world

DistanceJointDef #

Source
DistanceJointDef :: DistanceJointDef

Distance joint definition This requires defining an anchor point on both bodies and the non-zero distance of the distance joint. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. This helps when saving and loading a game. @ingroup distance_joint

DynamicTree #

Source
DynamicTree :: DynamicTree

The dynamic tree structure. This should be considered private data. It is placed here for performance reasons.

EnqueueTaskCallback #

Source
EnqueueTaskCallback :: EnqueueTaskCallback

These functions can be provided to Box2D to invoke a task system. These are designed to work well with enkiTS. Returns a pointer to the user's task object. May be nullptr. A nullptr indicates to Box2D that the work was executed serially within the callback and there is no need to call b2FinishTaskCallback. The itemCount is the number of Box2D work items that are to be partitioned among workers by the user's task system. This is essentially a parallel-for. The minRange parameter is a suggestion of the minimum number of items to assign per worker to reduce overhead. For example, suppose the task is small and that itemCount is 16. A minRange of 8 suggests that your task system should split the work items among just two workers, even if you have more available. In general the range [startIndex, endIndex) send to TaskCallback should obey: endIndex - startIndex >= minRange The exception of course is when itemCount < minRange. @ingroup world

ExplosionDef #

Source
ExplosionDef :: ExplosionDef

The explosion definition is used to configure options for explosions. Explosions consider shape geometry when computing the impulse. @ingroup world

Filter #

Source
Filter :: Filter

This is used to filter collision on shapes. It affects shape-vs-shape collision and shape-versus-query collision (such as b2World_CastRay). @ingroup shape

FilterJointDef #

Source
FilterJointDef :: FilterJointDef

A filter joint is used to disable collision between two specific bodies. @ingroup filter_joint

FreeFcn #

Source
FreeFcn :: FreeFcn

Prototype for user free function @param mem the memory previously allocated through `b2AllocFcn`

FrictionCallback #

Source
FrictionCallback :: FrictionCallback

Optional friction mixing callback. This intentionally provides no context objects because this is called from a worker thread. @warning This function should not attempt to modify Box2D state or user application state. @ingroup world

HexColor #

Source
HexColor :: HexColor

These colors are used for debug draw and mostly match the named SVG colors. See https://www.rapidtables.com/web/color/index.html https://johndecember.com/html/spec/colorsvg.html https://upload.wikimedia.org/wikipedia/commons/2/2b/SVG_Recognized_color_keyword_names.svg

Hull #

Source
Hull :: Hull

A convex hull. Used to create convex polygons. @warning Do not modify these values directly, instead use b2ComputeHull()

JointId #

Source
JointId :: JointId

/ Joint id references a joint instance. This should be treated as an opaque handle.

JointType #

Source
JointType :: JointType

Joint type enumeration This is useful because all joint types use b2JointId and sometimes you want to get the type of a joint. @ingroup joint

Manifold #

Source
Manifold :: Manifold

A contact manifold describes the contact points between colliding shapes. @note Box2D uses speculative collision so some contact points may be separated.

ManifoldPoint #

Source
ManifoldPoint :: ManifoldPoint

A manifold point is a contact point belonging to a contact manifold. It holds details related to the geometry and dynamics of the contact points. Box2D uses speculative collision so some contact points may be separated. You may use the totalNormalImpulse to determine if there was an interaction during the time step.

MotorJointDef #

Source
MotorJointDef :: MotorJointDef

A motor joint is used to control the relative motion between two bodies A typical usage is to control the movement of a dynamic body with respect to the ground. @ingroup motor_joint

MouseJointDef #

Source
MouseJointDef :: MouseJointDef

A mouse joint is used to make a point on a body track a specified world point. This a soft constraint and allows the constraint to stretch without applying huge forces. This also applies rotation constraint heuristic to improve control. @ingroup mouse_joint

OverlapResultFcn #

Source
OverlapResultFcn :: OverlapResultFcn

Prototype callback for overlap queries. Called for each shape found in the query. @see b2World_QueryAABB @return false to terminate the query. @ingroup world

PlaneResultFcn #

Source
PlaneResultFcn :: PlaneResultFcn

Used to collect collision planes for character movers. Return true to continue gathering planes.

Polygon #

Source
Polygon :: Polygon

A solid convex polygon. It is assumed that the interior of the polygon is to the left of each edge. Polygons have a maximum number of vertices equal to MAX_POLYGON_VERTICES. In most cases you should not need many vertices for a convex polygon. @warning DO NOT fill this out manually, instead use a helper function like b2MakePolygon or b2MakeBox.

PreSolveFcn #

Source
PreSolveFcn :: PreSolveFcn

Prototype for a pre-solve callback. This is called after a contact is updated. This allows you to inspect a contact before it goes to the solver. If you are careful, you can modify the contact manifold (e.g. modify the normal). Notes: - this function must be thread-safe - this is only called if the shape has enabled pre-solve events - this is called only for awake dynamic bodies - this is not called for sensors - the supplied manifold has impulse values from the previous step Return false if you want to disable the contact this step @warning Do not attempt to modify the world inside this callback @ingroup world

PrismaticJointDef #

Source
PrismaticJointDef :: PrismaticJointDef

Prismatic joint definition This requires defining a line of motion using an axis and an anchor point. The definition uses local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint translation is zero when the local anchor points coincide in world space. @ingroup prismatic_joint

QueryFilter #

Source
QueryFilter :: QueryFilter

The query filter is used to filter collisions between queries and shapes. For example, you may want a ray-cast representing a projectile to hit players and the static environment but not debris. @ingroup shape

RayResult #

Source
RayResult :: RayResult

Result from b2World_RayCastClosest If there is initial overlap the fraction and normal will be zero while the point is an arbitrary point in the overlap region. @ingroup world

RestitutionCallback #

Source
RestitutionCallback :: RestitutionCallback

Optional restitution mixing callback. This intentionally provides no context objects because this is called from a worker thread. @warning This function should not attempt to modify Box2D state or user application state. @ingroup world

RevoluteJointDef #

Source
RevoluteJointDef :: RevoluteJointDef

Revolute joint definition This requires defining an anchor point where the bodies are joined. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. You also need to specify the initial relative angle for joint limits. This helps when saving and loading a game. The local anchor points are measured from the body's origin rather than the center of mass because: 1. you might not know where the center of mass will be 2. if you add/remove shapes from a body and recompute the mass, the joints will be broken @ingroup revolute_joint

SensorEndTouchEvent #

Source
SensorEndTouchEvent :: SensorEndTouchEvent

An end touch event is generated when a shape stops overlapping a sensor shape. These include things like setting the transform, destroying a body or shape, or changing a filter. You will also get an end event if the sensor or visitor are destroyed. Therefore you should always confirm the shape id is valid using b2Shape_IsValid.

SensorEvents #

Source
SensorEvents :: SensorEvents

Sensor events are buffered in the Box2D world and are available as begin/end overlap event arrays after the time step is complete. Note: these may become invalid if bodies and/or shapes are destroyed

ShapeCastInput #

Source
ShapeCastInput :: ShapeCastInput

Low level shape cast input in generic form. This allows casting an arbitrary point cloud wrap with a radius. For example, a circle is a single point with a non-zero radius. A capsule is two points with a non-zero radius. A box is four points with a zero radius.

ShapeDef #

Source
ShapeDef :: ShapeDef

Used to create a shape. This is a temporary object used to bundle shape creation parameters. You may use the same shape definition to create multiple shapes. Must be initialized using b2DefaultShapeDef(). @ingroup shape

ShapeId #

Source
ShapeId :: ShapeId

/ Shape id references a shape instance. This should be treated as an opaque handle.

ShapeProxy #

Source
ShapeProxy :: ShapeProxy

A distance proxy is used by the GJK algorithm. It encapsulates any shape. You can provide between 1 and MAX_POLYGON_VERTICES and a radius.

SimplexCache #

Source
SimplexCache :: SimplexCache

Used to warm start the GJK simplex. If you call this function multiple times with nearby transforms this might improve performance. Otherwise you can zero initialize this. The distance cache must be initialized to zero on the first call. Users should generally just zero initialize this structure for each call.

SurfaceMaterial #

Source
SurfaceMaterial :: SurfaceMaterial

Surface materials allow chain shapes to have per segment surface properties. @ingroup shape

Sweep #

Source
Sweep :: Sweep

This describes the motion of a body/shape for TOI computation. Shapes are defined with respect to the body origin, which may not coincide with the center of mass. However, to support dynamics we must interpolate the center of mass position.

TaskCallback #

Source
TaskCallback :: TaskCallback

Task interface This is prototype for a Box2D task. Your task system is expected to invoke the Box2D task with these arguments. The task spans a range of the parallel-for: [startIndex, endIndex) The worker index must correctly identify each worker in the user thread pool, expected in [0, workerCount). A worker must only exist on only one thread at a time and is analogous to the thread index. The task context is the context pointer sent from Box2D when it is enqueued. The startIndex and endIndex are expected in the range [0, itemCount) where itemCount is the argument to b2EnqueueTaskCallback below. Box2D expects startIndex < endIndex and will execute a loop like this: @code{.odin} for i in startIndex ..< endIndex { DoWork() } @endcode @ingroup world

TreeQueryCallbackFcn #

Source
TreeQueryCallbackFcn :: TreeQueryCallbackFcn

This function receives proxies found in the AABB query. @return true if the query should continue

TreeRayCastCallbackFcn #

Source
TreeRayCastCallbackFcn :: TreeRayCastCallbackFcn

This function receives clipped raycast input for a proxy. The function returns the new ray fraction. - return a value of 0 to terminate the ray cast - return a value less than input->maxFraction to clip the ray - return a value of input->maxFraction to continue the ray cast without clipping

TreeShapeCastCallbackFcn #

Source
TreeShapeCastCallbackFcn :: TreeShapeCastCallbackFcn

This function receives clipped ray cast input for a proxy. The function returns the new ray fraction. - return a value of 0 to terminate the ray cast - return a value less than input->maxFraction to clip the ray - return a value of input->maxFraction to continue the ray cast without clipping

WeldJointDef #

Source
WeldJointDef :: WeldJointDef

Weld joint definition A weld joint connect to bodies together rigidly. This constraint provides springs to mimic soft-body simulation. @note The approximate solver in Box2D cannot hold many bodies together rigidly @ingroup weld_joint

WheelJointDef #

Source
WheelJointDef :: WheelJointDef

Wheel joint definition This requires defining a line of motion using an axis and an anchor point. The definition uses local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint translation is zero when the local anchor points coincide in world space. @ingroup wheel_joint

WorldDef #

Source
WorldDef :: WorldDef

World definition used to create a simulation world. Must be initialized using b2DefaultWorldDef(). @ingroup world

WorldId #

Source
WorldId :: WorldId

/ World id references a world instance. This should be treated as an opaque handle.

Procedures

489

AABB_Center #

Source
@(require_results)
AABB_Center :: proc "c" (a: AABB) -> [2]f32 {…}

Get the center of the AABB.

AABB_Contains #

Source
@(require_results)
AABB_Contains :: proc "c" (a, b: AABB) -> bool {…}

Does a fully contain b

AABB_Extents #

Source
@(require_results)
AABB_Extents :: proc "c" (a: AABB) -> [2]f32 {…}

Get the extents of the AABB (half-widths).

AABB_Overlaps #

Source
@(require_results)
AABB_Overlaps :: proc "c" (a, b: AABB) -> bool {…}

Do a and b overlap

AABB_Union #

Source
@(require_results)
AABB_Union :: proc "c" (a, b: AABB) -> (c: AABB) {…}

Union of two AABBs

Abs #

Source
@(require_results)
Abs :: proc "c" (a: [2]f32) -> (b: [2]f32) {…}

Component-wise absolute vector

AbsFloat #

Source
@(deprecated="Prefer the built-in 'abs(a)'")
@(require_results)
AbsFloat :: proc "c" (a: f32) -> f32 {…}

@return the absolute value of a float

AbsInt #

Source
@(deprecated="Prefer the built-in 'abs(a)'")
@(require_results)
AbsInt :: proc "c" (a: i32) -> i32 {…}

@return the absolute value of an integer

Add #

Source
@(deprecated="Prefer 'a + b'")
@(require_results)
Add :: proc "c" (a, b: [2]f32) -> [2]f32 {…}

Vector addition

b2SpringDamper #

Source
@(require_results)
b2SpringDamper :: proc "c" (hertz, dampingRatio, position, velocity, timeStep: f32) -> f32 {…}

One-dimensional mass-spring-damper simulation. Returns the new velocity given the position and time step. You can then compute the new position using: position += timeStep * newVelocity This drives towards a zero position. By using implicit integration we get a stable solution that doesn't require transcendental functions.

Body_ApplyAngularImpulse #

Source
Body_ApplyAngularImpulse :: proc "c" (bodyId: BodyId, impulse: f32, wake: bool) ---

Apply an angular impulse. The impulse is ignored if the body is not awake. This optionally wakes the body. @param bodyId The body id @param impulse the angular impulse, usually in units of kg*m*m/s @param wake also wake up the body @warning This should be used for one-shot impulses. If you need a steady force, use a force instead, which will work better with the sub-stepping solver.

Body_ApplyForce #

Source
Body_ApplyForce :: proc "c" (bodyId: BodyId, force: [2]f32, point: [2]f32, wake: bool) ---

Apply a force at a world point. If the force is not applied at the center of mass, it will generate a torque and affect the angular velocity. This optionally wakes up the body. The force is ignored if the body is not awake. @param bodyId The body id @param force The world force vector, usually in newtons (N) @param point The world position of the point of application @param wake Option to wake up the body

Body_ApplyForceToCenter #

Source
Body_ApplyForceToCenter :: proc "c" (bodyId: BodyId, force: [2]f32, wake: bool) ---

Apply a force to the center of mass. This optionally wakes up the body. The force is ignored if the body is not awake. @param bodyId The body id @param force the world force vector, usually in newtons (N). @param wake also wake up the body

Body_ApplyLinearImpulse #

Source
Body_ApplyLinearImpulse :: proc "c" (bodyId: BodyId, impulse: [2]f32, point: [2]f32, wake: bool) ---

Apply an impulse at a point. This immediately modifies the velocity. It also modifies the angular velocity if the point of application is not at the center of mass. This optionally wakes the body. The impulse is ignored if the body is not awake. @param bodyId The body id @param impulse the world impulse vector, usually in N*s or kg*m/s. @param point the world position of the point of application. @param wake also wake up the body @warning This should be used for one-shot impulses. If you need a steady force, use a force instead, which will work better with the sub-stepping solver.

Body_ApplyLinearImpulseToCenter #

Source
Body_ApplyLinearImpulseToCenter :: proc "c" (bodyId: BodyId, impulse: [2]f32, wake: bool) ---

Apply an impulse to the center of mass. This immediately modifies the velocity. The impulse is ignored if the body is not awake. This optionally wakes the body. @param bodyId The body id @param impulse the world impulse vector, usually in N*s or kg*m/s. @param wake also wake up the body @warning This should be used for one-shot impulses. If you need a steady force, use a force instead, which will work better with the sub-stepping solver.

Body_ApplyMassFromShapes #

Source
Body_ApplyMassFromShapes :: proc "c" (bodyId: BodyId) ---

This update the mass properties to the sum of the mass properties of the shapes. This normally does not need to be called unless you called SetMassData to override the mass and you later want to reset the mass. You may also use this when automatic mass computation has been disabled. You should call this regardless of body type.

Body_ApplyTorque #

Source
Body_ApplyTorque :: proc "c" (bodyId: BodyId, torque: f32, wake: bool) ---

Apply a torque. This affects the angular velocity without affecting the linear velocity. This optionally wakes the body. The torque is ignored if the body is not awake. @param bodyId The body id @param torque about the z-axis (out of the screen), usually in N*m. @param wake also wake up the body

Body_ComputeAABB #

Source
Body_ComputeAABB :: proc "c" (bodyId: BodyId) -> AABB ---

Get the current world AABB that contains all the attached shapes. Note that this may not encompass the body origin. If there are no shapes attached then the returned AABB is empty and centered on the body origin.

Body_Disable #

Source
Body_Disable :: proc "c" (bodyId: BodyId) ---

Disable a body by removing it completely from the simulation. This is expensive.

Body_Enable #

Source
Body_Enable :: proc "c" (bodyId: BodyId) ---

Enable a body by adding it to the simulation. This is expensive.

Body_EnableContactEvents #

Source
Body_EnableContactEvents :: proc "c" (bodyId: BodyId, flag: bool) ---

Enable/disable contact events on all shapes. @see b2ShapeDef::enableContactEvents @warning changing this at runtime may cause mismatched begin/end touch events

Body_EnableHitEvents #

Source
Body_EnableHitEvents :: proc "c" (bodyId: BodyId, flag: bool) ---

Enable/disable hit events on all shapes @see b2ShapeDef::enableHitEvents

Body_EnableSleep #

Source
Body_EnableSleep :: proc "c" (bodyId: BodyId, enableSleep: bool) ---

Enable or disable sleeping for this body. If sleeping is disabled the body will wake.

Body_GetAngularDamping #

Source
Body_GetAngularDamping :: proc "c" (bodyId: BodyId) -> f32 ---

Get the current angular damping.

Body_GetAngularVelocity #

Source
Body_GetAngularVelocity :: proc "c" (bodyId: BodyId) -> f32 ---

Get the angular velocity of a body in radians per second

Body_GetContactCapacity #

Source
Body_GetContactCapacity :: proc "c" (bodyId: BodyId) -> i32 ---

Get the maximum capacity required for retrieving all the touching contacts on a body

Body_GetGravityScale #

Source
Body_GetGravityScale :: proc "c" (bodyId: BodyId) -> f32 ---

Get the current gravity scale

Body_GetJointCount #

Source
Body_GetJointCount :: proc "c" (bodyId: BodyId) -> i32 ---

Get the number of joints on this body

Body_GetJoints #

Source
@(require_results)
Body_GetJoints :: proc "c" (bodyId: BodyId, jointArray: []JointId) -> []JointId {…}

Get the joint ids for all joints on this body, up to the provided capacity @returns the joint ids stored in the user array

Body_GetLinearDamping #

Source
Body_GetLinearDamping :: proc "c" (bodyId: BodyId) -> f32 ---

Get the current linear damping.

Body_GetLinearVelocity #

Source
Body_GetLinearVelocity :: proc "c" (bodyId: BodyId) -> [2]f32 ---

Get the linear velocity of a body's center of mass. Usually in meters per second.

Body_GetLocalCenterOfMass #

Source
Body_GetLocalCenterOfMass :: proc "c" (bodyId: BodyId) -> [2]f32 ---

Get the center of mass position of the body in local space

Body_GetLocalPoint #

Source
Body_GetLocalPoint :: proc "c" (bodyId: BodyId, worldPoint: [2]f32) -> [2]f32 ---

Get a local point on a body given a world point

Body_GetLocalPointVelocity #

Source
Body_GetLocalPointVelocity :: proc "c" (bodyId: BodyId, localPoint: [2]f32) -> [2]f32 ---

Get the linear velocity of a local point attached to a body. Usually in meters per second.

Body_GetLocalVector #

Source
Body_GetLocalVector :: proc "c" (bodyId: BodyId, worldVector: [2]f32) -> [2]f32 ---

Get a local vector on a body given a world vector

Body_GetMass #

Source
Body_GetMass :: proc "c" (bodyId: BodyId) -> f32 ---

Get the mass of the body, usually in kilograms

Body_GetPosition #

Source
Body_GetPosition :: proc "c" (bodyId: BodyId) -> [2]f32 ---

Get the world position of a body. This is the location of the body origin.

Body_GetRotation #

Source
Body_GetRotation :: proc "c" (bodyId: BodyId) -> Rot ---

Get the world rotation of a body as a cosine/sine pair (complex number)

Body_GetRotationalInertia #

Source
Body_GetRotationalInertia :: proc "c" (bodyId: BodyId) -> f32 ---

Get the rotational inertia of the body, usually in kg*m^2

Body_GetShapeCount #

Source
Body_GetShapeCount :: proc "c" (bodyId: BodyId) -> i32 ---

Get the number of shapes on this body

Body_GetShapes #

Source
@(require_results)
Body_GetShapes :: proc "c" (bodyId: BodyId, shapeArray: []ShapeId) -> []ShapeId {…}

Get the shape ids for all shapes on this body, up to the provided capacity. @returns the shape ids stored in the user array

Body_GetSleepThreshold #

Source
Body_GetSleepThreshold :: proc "c" (bodyId: BodyId) -> f32 ---

Get the sleep threshold, usually in meters per second.

Body_GetWorldCenterOfMass #

Source
Body_GetWorldCenterOfMass :: proc "c" (bodyId: BodyId) -> [2]f32 ---

Get the center of mass position of the body in world space

Body_GetWorldPoint #

Source
Body_GetWorldPoint :: proc "c" (bodyId: BodyId, localPoint: [2]f32) -> [2]f32 ---

Get a world point on a body given a local point

Body_GetWorldPointVelocity #

Source
Body_GetWorldPointVelocity :: proc "c" (bodyId: BodyId, worldPoint: [2]f32) -> [2]f32 ---

Get the linear velocity of a world point attached to a body. Usually in meters per second.

Body_GetWorldVector #

Source
Body_GetWorldVector :: proc "c" (bodyId: BodyId, localVector: [2]f32) -> [2]f32 ---

Get a world vector on a body given a local vector

Body_IsFixedRotation #

Source
Body_IsFixedRotation :: proc "c" (bodyId: BodyId) -> bool ---

Does this body have fixed rotation?

Body_IsSleepEnabled #

Source
Body_IsSleepEnabled :: proc "c" (bodyId: BodyId) -> bool ---

Returns true if sleeping is enabled for this body

Body_IsValid #

Source
Body_IsValid :: proc "c" (id: BodyId) -> bool ---

Body identifier validation. Can be used to detect orphaned ids. Provides validation for up to 64K allocations.

Body_SetAngularDamping #

Source
Body_SetAngularDamping :: proc "c" (bodyId: BodyId, angularDamping: f32) ---

Adjust the angular damping. Normally this is set in BodyDef before creation.

Body_SetAngularVelocity #

Source
Body_SetAngularVelocity :: proc "c" (bodyId: BodyId, angularVelocity: f32) ---

Set the angular velocity of a body in radians per second

Body_SetAwake #

Source
Body_SetAwake :: proc "c" (bodyId: BodyId, awake: bool) ---

Wake a body from sleep. This wakes the entire island the body is touching. @warning Putting a body to sleep will put the entire island of bodies touching this body to sleep, which can be expensive and possibly unintuitive.

Body_SetBullet #

Source
Body_SetBullet :: proc "c" (bodyId: BodyId, flag: bool) ---

Set this body to be a bullet. A bullet does continuous collision detection against dynamic bodies (but not other bullets).

Body_SetFixedRotation #

Source
Body_SetFixedRotation :: proc "c" (bodyId: BodyId, flag: bool) ---

Set this body to have fixed rotation. This causes the mass to be reset in all cases.

Body_SetGravityScale #

Source
Body_SetGravityScale :: proc "c" (bodyId: BodyId, gravityScale: f32) ---

Adjust the gravity scale. Normally this is set in BodyDef before creation. @see BodyDef::gravityScale

Body_SetLinearDamping #

Source
Body_SetLinearDamping :: proc "c" (bodyId: BodyId, linearDamping: f32) ---

Adjust the linear damping. Normally this is set in BodyDef before creation.

Body_SetLinearVelocity #

Source
Body_SetLinearVelocity :: proc "c" (bodyId: BodyId, linearVelocity: [2]f32) ---

Set the linear velocity of a body. Usually in meters per second.

Body_SetMassData #

Source
Body_SetMassData :: proc "c" (bodyId: BodyId, massData: MassData) ---

Override the body's mass properties. Normally this is computed automatically using the shape geometry and density. This information is lost if a shape is added or removed or if the body type changes.

Body_SetName #

Source
Body_SetName :: proc "c" (bodyId: BodyId, name: cstring) ---

Set the body name. Up to 32 characters excluding 0 termination.

Body_SetSleepThreshold #

Source
Body_SetSleepThreshold :: proc "c" (bodyId: BodyId, sleepThreshold: f32) ---

Set the sleep threshold, usually in meters per second

Body_SetTargetTransform #

Source
Body_SetTargetTransform :: proc "c" (bodyId: BodyId, target: Transform, timeStep: f32) ---

Set the velocity to reach the given transform after a given time step. The result will be close but maybe not exact. This is meant for kinematic bodies. The target is not applied if the velocity would be below the sleep threshold. This will automatically wake the body if asleep.

Body_SetTransform #

Source
Body_SetTransform :: proc "c" (bodyId: BodyId, position: [2]f32, rotation: Rot) ---

Set the world transform of a body. This acts as a teleport and is fairly expensive. @note Generally you should create a body with then intended transform. @see BodyDef::position and BodyDef::angle

Body_SetType #

Source
Body_SetType :: proc "c" (bodyId: BodyId, type: BodyType) ---

Change the body type. This is an expensive operation. This automatically updates the mass properties regardless of the automatic mass setting.

Chain_GetSegmentCount #

Source
Chain_GetSegmentCount :: proc "c" (chainId: ChainId) -> i32 ---

Get the number of segments on this chain

Chain_GetSegments #

Source
Chain_GetSegments :: proc "c" (chainId: ChainId, segmentArray: [^]ShapeId, capacity: i32) -> i32 ---

Fill a user array with chain segment shape ids up to the specified capacity. Returns the actual number of segments returned.

Chain_IsValid #

Source
Chain_IsValid :: proc "c" (id: ChainId) -> bool ---

Chain identifier validation. Provides validation for up to 64K allocations.

Chain_SetFriction #

Source
Chain_SetFriction :: proc "c" (chainId: ChainId, friction: f32) ---

Set the chain friction @see b2ChainDef::friction

Chain_SetMaterial #

Source
Chain_SetMaterial :: proc "c" (chainId: ChainId, material: i32) ---

Set the chain material @see b2ChainDef::material

Chain_SetRestitution #

Source
Chain_SetRestitution :: proc "c" (chainId: ChainId, restitution: f32) ---

Set the chain restitution (bounciness) @see b2ChainDef::restitution

Clamp #

Source
@(require_results)
Clamp :: proc "c" (v: [2]f32, a, b: [2]f32) -> (c: [2]f32) {…}

Component-wise clamp vector v into the range [a, b]

ClampFloat #

Source
@(deprecated="Prefer the built-in 'clamp(a, lower, upper)'")
@(require_results)
ClampFloat :: proc "c" (a, lower, upper: f32) -> f32 {…}

@return a f32 clamped between a lower and upper bound

ClampInt #

Source
@(deprecated="Prefer the built-in 'clamp(a, lower, upper)'")
@(require_results)
ClampInt :: proc "c" (a, lower, upper: i32) -> i32 {…}

@return an integer clamped between a lower and upper bound

ComputeAngularVelocity #

Source
@(require_results)
ComputeAngularVelocity :: proc "c" (q1: Rot, q2: Rot, inv_h: f32) -> f32 {…}

Compute the angular velocity necessary to rotate between two rotations over a give time @param q1 initial rotation @param q2 final rotation @param inv_h inverse time step

ComputeHull #

Source
@(require_results)
ComputeHull :: proc "c" (points: [][2]f32) -> Hull {…}

Compute the convex hull of a set of points. Returns an empty hull if it fails. Some failure cases: - all points very close together - all points on a line - less than 3 points - more than MAX_POLYGON_VERTICES points This welds close points and removes collinear points. @warning Do not modify a hull once it has been computed

ComputeRotationBetweenUnitVectors #

Source
@(require_results)
ComputeRotationBetweenUnitVectors :: proc(v1, v2: [2]f32) -> Rot {…}

Compute the rotation between two unit vectors

ComputeSegmentAABB #

Source
ComputeSegmentAABB :: proc "c" (#by_ptr shape: Segment, transform: Transform) -> AABB ---

Compute the bounding box of a transformed line segment

CreateBody #

Source
CreateBody :: proc "c" (worldId: WorldId, #by_ptr def: BodyDef) -> BodyId ---

Create a rigid body given a definition. No reference to the definition is retained. So you can create the definition on the stack and pass it as a pointer. @code{.odin} body_def := b2.DefaultBodyDef() my_body_id =: b2.CreateBody(my_world_id, body_def) @endcode @warning This function is locked during callbacks.

CreateCapsuleShape #

Source
CreateCapsuleShape :: proc "c" (bodyId: BodyId, #by_ptr def: ShapeDef, #by_ptr capsule: Capsule) -> ShapeId ---

Create a capsule shape and attach it to a body. The shape definition and geometry are fully cloned. Contacts are not created until the next time step. @return the shape id for accessing the shape

CreateCircleShape #

Source
CreateCircleShape :: proc "c" (bodyId: BodyId, #by_ptr def: ShapeDef, #by_ptr circle: Circle) -> ShapeId ---

Create a circle shape and attach it to a body. The shape definition and geometry are fully cloned. Contacts are not created until the next time step. @return the shape id for accessing the shape

CreatePolygonShape #

Source
CreatePolygonShape :: proc "c" (bodyId: BodyId, #by_ptr def: ShapeDef, #by_ptr polygon: Polygon) -> ShapeId ---

Create a polygon shape and attach it to a body. The shape definition and geometry are fully cloned. Contacts are not created until the next time step. @return the shape id for accessing the shape

CreateSegmentShape #

Source
CreateSegmentShape :: proc "c" (bodyId: BodyId, #by_ptr def: ShapeDef, #by_ptr segment: Segment) -> ShapeId ---

Create a line segment shape and attach it to a body. The shape definition and geometry are fully cloned. Contacts are not created until the next time step. @return the shape id for accessing the shape

CreateWorld #

Source
CreateWorld :: proc "c" (#by_ptr def: WorldDef) -> WorldId ---

Create a world for rigid body simulation. A world contains bodies, shapes, and constraints. You make create up to 128 worlds. Each world is completely independent and may be simulated in parallel. @return the world id.

Cross #

Source
@(require_results)
Cross :: proc "c" (a, b: [2]f32) -> f32 {…}

Vector cross product. In 2D this yields a scalar.

CrossSV #

Source
@(require_results)
CrossSV :: proc "c" (s: f32, v: [2]f32) -> [2]f32 {…}

Perform the cross product on a scalar and a vector. In 2D this produces a vector.

CrossVS #

Source
@(require_results)
CrossVS :: proc "c" (v: [2]f32, s: f32) -> [2]f32 {…}

Perform the cross product on a vector and a scalar. In 2D this produces a vector.

DefaultBodyDef #

Source
DefaultBodyDef :: proc "c" () -> BodyDef ---

Use this to initialize your body definition @ingroup body

DefaultChainDef #

Source
DefaultChainDef :: proc "c" () -> ChainDef ---

Use this to initialize your chain definition @ingroup shape

DefaultDebugDraw #

Source
DefaultDebugDraw :: proc "c" () -> DebugDraw ---

Use this to initialize your drawing interface. This allows you to implement a sub-set of the drawing functions.

DefaultDistanceJointDef #

Source
DefaultDistanceJointDef :: proc "c" () -> DistanceJointDef ---

Use this to initialize your joint definition @ingroup distance_joint

DefaultExplosionDef #

Source
DefaultExplosionDef :: proc "c" () -> ExplosionDef ---

Use this to initialize your explosion definition @ingroup world

DefaultFilter #

Source
DefaultFilter :: proc "c" () -> Filter ---

Use this to initialize your filter @ingroup shape

DefaultFilterJointDef #

Source
DefaultFilterJointDef :: proc "c" () -> FilterJointDef ---

Use this to initialize your joint definition @ingroup filter_joint

DefaultMotorJointDef #

Source
DefaultMotorJointDef :: proc "c" () -> MotorJointDef ---

Use this to initialize your joint definition @ingroup motor_joint

DefaultMouseJointDef #

Source
DefaultMouseJointDef :: proc "c" () -> MouseJointDef ---

Use this to initialize your joint definition @ingroup mouse_joint

DefaultPrismaticJointDef #

Source
DefaultPrismaticJointDef :: proc "c" () -> PrismaticJointDef ---

Use this to initialize your joint definition @ingroupd prismatic_joint

DefaultQueryFilter #

Source
DefaultQueryFilter :: proc "c" () -> QueryFilter ---

Use this to initialize your query filter @ingroup shape

DefaultRevoluteJointDef #

Source
DefaultRevoluteJointDef :: proc "c" () -> RevoluteJointDef ---

Use this to initialize your joint definition. @ingroup revolute_joint

DefaultShapeDef #

Source
DefaultShapeDef :: proc "c" () -> ShapeDef ---

Use this to initialize your shape definition @ingroup shape

DefaultSurfaceMaterial #

Source
DefaultSurfaceMaterial :: proc "c" () -> SurfaceMaterial ---

Use this to initialize your surface material @ingroup shape

DefaultWeldJointDef #

Source
DefaultWeldJointDef :: proc "c" () -> WeldJointDef ---

Use this to initialize your joint definition @ingroup weld_joint

DefaultWheelJointDef #

Source
DefaultWheelJointDef :: proc "c" () -> WheelJointDef ---

Use this to initialize your joint definition @ingroup wheel_joint

DefaultWorldDef #

Source
DefaultWorldDef :: proc "c" () -> WorldDef ---

Use this to initialize your world definition @ingroup world

DestroyBody #

Source
DestroyBody :: proc "c" (bodyId: BodyId) ---

Destroy a rigid body given an id. This destroys all shapes and joints attached to the body. Do not keep references to the associated shapes and joints.

DestroyShape #

Source
DestroyShape :: proc "c" (shapeId: ShapeId, updateBodyMass: bool) ---

Destroy a shape. You may defer the body mass update which can improve performance if several shapes on a body are destroyed at once. @see b2Body_ApplyMassFromShapes

Distance #

Source
@(require_results)
Distance :: proc "c" (a, b: [2]f32) -> f32 {…}

Get the distance between two points

DistanceJoint_EnableLimit #

Source
DistanceJoint_EnableLimit :: proc "c" (jointId: JointId, enableLimit: bool) ---

Enable joint limit. The limit only works if the joint spring is enabled. Otherwise the joint is rigid and the limit has no effect.

DistanceJoint_EnableMotor #

Source
DistanceJoint_EnableMotor :: proc "c" (jointId: JointId, enableMotor: bool) ---

Enable/disable the distance joint motor

DistanceJoint_EnableSpring #

Source
DistanceJoint_EnableSpring :: proc "c" (jointId: JointId, enableSpring: bool) ---

Enable/disable the distance joint spring. When disabled the distance joint is rigid.

DistanceJoint_GetCurrentLength #

Source
DistanceJoint_GetCurrentLength :: proc "c" (jointId: JointId) -> f32 ---

Get the current length of a distance joint

DistanceJoint_GetLength #

Source
DistanceJoint_GetLength :: proc "c" (jointId: JointId) -> f32 ---

Get the rest length of a distance joint

DistanceJoint_GetMaxLength #

Source
DistanceJoint_GetMaxLength :: proc "c" (jointId: JointId) -> f32 ---

Get the distance joint maximum length

DistanceJoint_GetMaxMotorForce #

Source
DistanceJoint_GetMaxMotorForce :: proc "c" (jointId: JointId) -> f32 ---

Get the distance joint maximum motor force, usually in newtons

DistanceJoint_GetMinLength #

Source
DistanceJoint_GetMinLength :: proc "c" (jointId: JointId) -> f32 ---

Get the distance joint minimum length

DistanceJoint_GetMotorForce #

Source
DistanceJoint_GetMotorForce :: proc "c" (jointId: JointId) -> f32 ---

Get the distance joint current motor force, usually in newtons

DistanceJoint_GetMotorSpeed #

Source
DistanceJoint_GetMotorSpeed :: proc "c" (jointId: JointId) -> f32 ---

Get the distance joint motor speed, usually in meters per second

DistanceJoint_GetSpringDampingRatio #

Source
DistanceJoint_GetSpringDampingRatio :: proc "c" (jointId: JointId) -> f32 ---

Get the spring damping ratio

DistanceJoint_GetSpringHertz #

Source
DistanceJoint_GetSpringHertz :: proc "c" (jointId: JointId) -> f32 ---

Get the spring Hertz

DistanceJoint_IsLimitEnabled #

Source
DistanceJoint_IsLimitEnabled :: proc "c" (jointId: JointId) -> bool ---

Is the distance joint limit enabled?

DistanceJoint_IsMotorEnabled #

Source
DistanceJoint_IsMotorEnabled :: proc "c" (jointId: JointId) -> bool ---

Is the distance joint motor enabled?

DistanceJoint_IsSpringEnabled #

Source
DistanceJoint_IsSpringEnabled :: proc "c" (jointId: JointId) -> bool ---

Is the distance joint spring enabled?

DistanceJoint_SetLength #

Source
DistanceJoint_SetLength :: proc "c" (jointId: JointId, length: f32) ---

Set the rest length of a distance joint @param jointId The id for a distance joint @param length The new distance joint length

DistanceJoint_SetLengthRange #

Source
DistanceJoint_SetLengthRange :: proc "c" (jointId: JointId, minLength, maxLength: f32) ---

Set the minimum and maximum length parameters of a distance joint

DistanceJoint_SetMaxMotorForce #

Source
DistanceJoint_SetMaxMotorForce :: proc "c" (jointId: JointId, force: f32) ---

Set the distance joint maximum motor force, usually in newtons

DistanceJoint_SetMotorSpeed #

Source
DistanceJoint_SetMotorSpeed :: proc "c" (jointId: JointId, motorSpeed: f32) ---

Set the distance joint motor speed, usually in meters per second

DistanceJoint_SetSpringDampingRatio #

Source
DistanceJoint_SetSpringDampingRatio :: proc "c" (jointId: JointId, dampingRatio: f32) ---

Set the spring damping ratio, non-dimensional

DistanceJoint_SetSpringHertz #

Source
DistanceJoint_SetSpringHertz :: proc "c" (jointId: JointId, hertz: f32) ---

Set the spring stiffness in Hertz

DistanceSquared #

Source
@(require_results)
DistanceSquared :: proc "c" (a, b: [2]f32) -> f32 {…}

Get the distance squared between points

DynamicTree_Create #

Source
DynamicTree_Create :: proc "c" () -> DynamicTree ---

Constructing the tree initializes the node pool.

DynamicTree_CreateProxy #

Source
DynamicTree_CreateProxy :: proc "c" (tree: ^DynamicTree, aabb: AABB, categoryBits: u64, userData: u64) -> i32 ---

Create a proxy. Provide an AABB and a userData value.

DynamicTree_Destroy #

Source
DynamicTree_Destroy :: proc "c" (tree: ^DynamicTree) ---

Destroy the tree, freeing the node pool.

DynamicTree_DestroyProxy #

Source
DynamicTree_DestroyProxy :: proc "c" (tree: ^DynamicTree, proxyId: i32) ---

Destroy a proxy. This asserts if the id is invalid.

DynamicTree_EnlargeProxy #

Source
DynamicTree_EnlargeProxy :: proc "c" (tree: ^DynamicTree, proxyId: i32, aabb: AABB) ---

Enlarge a proxy and enlarge ancestors as necessary.

DynamicTree_GetAreaRatio #

Source
DynamicTree_GetAreaRatio :: proc "c" (#by_ptr tree: DynamicTree) -> f32 ---

Get the ratio of the sum of the node areas to the root area.

DynamicTree_GetByteCount #

Source
DynamicTree_GetByteCount :: proc "c" (#by_ptr tree: DynamicTree) -> i32 ---

Get the number of bytes used by this tree

DynamicTree_GetCategoryBits #

Source
DynamicTree_GetCategoryBits :: proc "c" (tree: ^DynamicTree, proxyId: i32) ---

Get the category bits on a proxy.

DynamicTree_GetProxyCount #

Source
DynamicTree_GetProxyCount :: proc "c" (#by_ptr tree: DynamicTree) -> i32 ---

Get the number of proxies created

DynamicTree_GetRootBounds #

Source
DynamicTree_GetRootBounds :: proc "c" (#by_ptr tree: DynamicTree) -> AABB ---

Get the bounding box that contains the entire tree

DynamicTree_MoveProxy #

Source
DynamicTree_MoveProxy :: proc "c" (tree: ^DynamicTree, proxyId: i32, aabb: AABB) ---

Move a proxy to a new AABB by removing and reinserting into the tree.

DynamicTree_RayCast #

Source
DynamicTree_RayCast :: proc "c" (#by_ptr tree: DynamicTree, #by_ptr input: RayCastInput, maskBits: u64, callback: TreeRayCastCallbackFcn, ctx: rawptr) -> TreeStats ---

Ray cast against the proxies in the tree. This relies on the callback to perform a exact ray cast in the case were the proxy contains a shape. The callback also performs the any collision filtering. This has performance roughly equal to k * log(n), where k is the number of collisions and n is the number of proxies in the tree. Bit-wise filtering using mask bits can greatly improve performance in some scenarios. However, this filtering may be approximate, so the user should still apply filtering to results. @param tree the dynamic tree to ray cast @param input the ray cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1) @param maskBits mask bit hint: `bool accept = (maskBits & node->categoryBits) != 0;` @param callback a callback class that is called for each proxy that is hit by the ray @param context user context that is passed to the callback @return performance data

DynamicTree_Rebuild #

Source
DynamicTree_Rebuild :: proc "c" (tree: ^DynamicTree, fullBuild: bool) -> i32 ---

Rebuild the tree while retaining subtrees that haven't changed. Returns the number of boxes sorted.

DynamicTree_SetCategoryBits #

Source
DynamicTree_SetCategoryBits :: proc "c" (tree: ^DynamicTree, proxyId: i32, categoryBits: u64) ---

Modify the category bits on a proxy. This is an expensive operation.

DynamicTree_ShapeCast #

Source
DynamicTree_ShapeCast :: proc "c" (#by_ptr tree: DynamicTree, #by_ptr input: ShapeCastInput, maskBits: u32, callback: TreeShapeCastCallbackFcn, ctx: rawptr) -> TreeStats ---

Ray cast against the proxies in the tree. This relies on the callback to perform a exact ray cast in the case were the proxy contains a shape. The callback also performs the any collision filtering. This has performance roughly equal to k * log(n), where k is the number of collisions and n is the number of proxies in the tree. @param tree the dynamic tree to ray cast @param input the ray cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1). @param maskBits filter bits: `bool accept = (maskBits & node->categoryBits) != 0 ---` @param callback a callback class that is called for each proxy that is hit by the shape @param context user context that is passed to the callback @return performance data

DynamicTree_Validate #

Source
DynamicTree_Validate :: proc "c" (#by_ptr tree: DynamicTree) ---

Validate this tree. For testing.

DynamicTree_ValidateNoEnlarged #

Source
DynamicTree_ValidateNoEnlarged :: proc "c" (#by_ptr tree: DynamicTree) ---

Validate this tree has no enlarged AABBs. For testing.

GetByteCount #

Source
GetByteCount :: proc "c" () -> i32 ---

@return the total bytes allocated by Box2D

GetInverse22 #

Source
@(require_results)
GetInverse22 :: proc "c" (A: matrix[2, 2]f32) -> matrix[2, 2]f32 {…}

Get the inverse of a 2-by-2 matrix

GetLengthAndNormalize #

Source
@(require_results)
GetLengthAndNormalize :: proc "c" (v: [2]f32) -> (length: f32, vn: [2]f32) {…}

GetLengthUnitsPerMeter #

Source
GetLengthUnitsPerMeter :: proc "c" () -> f32 ---

Get the current length units per meter.

GetMilliseconds #

Source
GetMilliseconds :: proc "c" (ticks: u64) -> f32 ---

Get the milliseconds passed from an initial tick value.

GetMillisecondsAndReset #

Source
GetMillisecondsAndReset :: proc "c" (ticks: ^u64) -> f32 ---

Get the milliseconds passed from an initial tick value. Resets the passed in value to the current tick value.

GetSweepTransform #

Source
GetSweepTransform :: proc "c" (#by_ptr sweep: Sweep, time: f32) -> Transform ---

Evaluate the transform sweep at a specific time.

GetTicks #

Source
GetTicks :: proc "c" () -> u64 ---

Get the absolute number of system ticks. The value is platform specific.

Hash #

Source
Hash :: proc "c" (hash: u32, data: [^]u8, count: i32) -> u32 ---

Simple djb2 hash function for determinism testing.

ID_EQUALS #

Source
ID_EQUALS :: proc "c" (id1, id2: $T) -> bool {…}

/ Compare two ids for equality. Doesn't work for b2WorldId.

IntegrateRotation #

Source
@(require_results)
IntegrateRotation :: proc "c" (q1: Rot, deltaAngle: f32) -> Rot {…}

Integration rotation from angular velocity @param q1 initial rotation @param deltaAngle the angular displacement in radians

InvMulRot #

Source
@(require_results)
InvMulRot :: proc "c" (q, r: Rot) -> (qr: Rot) {…}

Transpose multiply two rotations: qT * r

InvMulTransforms #

Source
@(require_results)
InvMulTransforms :: proc "c" (A, B: Transform) -> (C: Transform) {…}

Creates a transform that converts a local point in frame B to a local point in frame A. v2 = A.q' * (B.q * v1 + B.p - A.p) = A.q' * B.q * v1 + A.q' * (B.p - A.p)

InvRotateVector #

Source
@(require_results)
InvRotateVector :: proc "c" (q: Rot, v: [2]f32) -> [2]f32 {…}

Inverse rotate a vector

InvTransformPoint #

Source
@(require_results)
InvTransformPoint :: proc "c" (t: Transform, p: [2]f32) -> [2]f32 {…}

Inverse transform a point (e.g. world space to local space)

IS_NON_NULL #

Source
IS_NON_NULL :: proc "c" (id: $T) -> bool {…}

/ Macro to determine if any id is non-null.

IS_NULL #

Source
IS_NULL :: proc "c" (id: $T) -> bool {…}

/ Macro to determine if any id is null.

IsNormalizedRot #

Source
@(require_results)
IsNormalizedRot :: proc "c" (q: Rot) -> bool {…}

Is this rotation normalized?

IsValidAABB #

Source
@(require_results)
IsValidAABB :: proc "c" (aabb: AABB) -> bool {…}

Is this a valid bounding box? Not Nan or infinity. Upper bound greater than or equal to lower bound.

IsValidPlane #

Source
@(require_results)
IsValidPlane :: proc "c" (plane: Plane) -> bool {…}

Is this a valid plane? Normal is a unit vector. Not Nan or infinity.

Joint_GetAngularSeparation #

Source
Joint_GetAngularSeparation :: proc "c" (jointId: JointId) -> f32 ---

Get the current angular separation error for this joint. Does not consider admissible movement. Usually in meters.

Joint_GetCollideConnected #

Source
Joint_GetCollideConnected :: proc "c" (jointId: JointId) -> bool ---

Is collision allowed between connected bodies?

Joint_GetConstraintForce #

Source
Joint_GetConstraintForce :: proc "c" (jointId: JointId) -> [2]f32 ---

Get the current constraint force for this joint. Usually in Newtons.

Joint_GetConstraintTorque #

Source
Joint_GetConstraintTorque :: proc "c" (jointId: JointId) -> f32 ---

Get the current constraint torque for this joint. Usually in Newton * meters.

Joint_GetConstraintTuning #

Source
Joint_GetConstraintTuning :: proc "c" (jointId: JointId, hertz: ^f32, dampingRatio: ^f32) ---

Get the joint constraint tuning. Advanced feature.

Joint_GetLinearSeparation #

Source
Joint_GetLinearSeparation :: proc "c" (jointId: JointId) -> f32 ---

Get the current linear separation error for this joint. Does not consider admissible movement. Usually in meters.

Joint_GetLocalAnchorA #

Source
Joint_GetLocalAnchorA :: proc "c" (jointId: JointId) -> [2]f32 ---

Get the local anchor on bodyA

Joint_GetLocalAnchorB #

Source
Joint_GetLocalAnchorB :: proc "c" (jointId: JointId) -> [2]f32 ---

Get the local anchor on bodyB

Joint_GetLocalAxisA #

Source
Joint_GetLocalAxisA :: proc "c" (jointId: JointId) -> [2]f32 ---

Get the local axis on bodyA (prismatic and wheel)

Joint_GetReferenceAngle #

Source
Joint_GetReferenceAngle :: proc "c" (jointId: JointId) -> f32 ---

Get the joint reference angle in radians (revolute, prismatic, and weld)

Joint_IsValid #

Source
Joint_IsValid :: proc "c" (id: JointId) -> bool ---

Joint identifier validation. Provides validation for up to 64K allocations.

Joint_SetCollideConnected #

Source
Joint_SetCollideConnected :: proc "c" (jointId: JointId, shouldCollide: bool) ---

Toggle collision between connected bodies

Joint_SetConstraintTuning #

Source
Joint_SetConstraintTuning :: proc "c" (jointId: JointId, hertz: f32, dampingRatio: f32) ---

Set the joint constraint tuning. Advanced feature. @param jointId the joint @param hertz the stiffness in Hertz (cycles per second) @param dampingRatio the non-dimensional damping ratio (one for critical damping)

Joint_SetLocalAnchorA #

Source
Joint_SetLocalAnchorA :: proc "c" (jointId: JointId, localAnchor: [2]f32) ---

Set the local anchor on bodyA

Joint_SetLocalAnchorB #

Source
Joint_SetLocalAnchorB :: proc "c" (jointId: JointId, localAnchor: [2]f32) ---

Set the local anchor on bodyB

Joint_SetLocalAxisA #

Source
Joint_SetLocalAxisA :: proc "c" (jointId: JointId, localAxis: [2]f32) ---

Set the local axis on bodyA (prismatic and wheel)

Joint_SetReferenceAngle #

Source
Joint_SetReferenceAngle :: proc "c" (jointId: JointId, angleInRadians: f32) ---

Set the joint reference angle in radians, must be in [-pi,pi]. (revolute, prismatic, and weld)

Joint_WakeBodies #

Source
Joint_WakeBodies :: proc "c" (jointId: JointId) ---

Wake the bodies connect to this joint

LeftPerp #

Source
@(require_results)
LeftPerp :: proc "c" (v: [2]f32) -> [2]f32 {…}

Get a left pointing perpendicular vector. Equivalent to b2CrossSV(1, v)

Length #

Source
@(require_results)
Length :: proc "c" (v: [2]f32) -> f32 {…}

Get the length of this vector (the norm)

LengthSquared #

Source
@(require_results)
LengthSquared :: proc "c" (v: [2]f32) -> f32 {…}

Get the length squared of this vector

Lerp #

Source
@(require_results)
Lerp :: proc "c" (a, b: [2]f32, t: f32) -> [2]f32 {…}

Vector linear interpolation https://fgiesen.wordpress.com/2012/08/15/linear-interpolation-past-present-and-future/

MakeAABB #

Source
@(require_results)
MakeAABB :: proc "c" (points: [][2]f32, radius: f32) -> AABB {…}

Compute the bounding box of an array of circles

MakeBox #

Source
MakeBox :: proc "c" (halfWidth, halfHeight: f32) -> Polygon ---

Make a box (rectangle) polygon, bypassing the need for a convex hull.

MakeOffsetBox #

Source
MakeOffsetBox :: proc "c" (halfWidth, halfHeight: f32, center: [2]f32, rotation: Rot) -> Polygon ---

Make an offset box, bypassing the need for a convex hull.

MakeOffsetPolygon #

Source
MakeOffsetPolygon :: proc "c" (#by_ptr hull: Hull, position: [2]f32, rotation: Rot) -> Polygon ---

Make an offset convex polygon from a convex hull. This will assert if the hull is not valid. @warning Do not manually fill in the hull data, it must come directly from b2ComputeHull

MakeOffsetProxy #

Source
@(require_results)
MakeOffsetProxy :: proc "c" (points: [][2]f32, radius: f32, position: [2]f32, rotation: Rot) -> ShapeProxy {…}

Make a proxy with a transform. This is a deep copy of the points.

MakeOffsetRoundedBox #

Source
MakeOffsetRoundedBox :: proc "c" (halfWidth, halfHeight: f32, center: [2]f32, rotation: Rot, radius: f32) -> Polygon ---

Make an offset rounded box, bypassing the need for a convex hull.

MakeOffsetRoundedPolygon #

Source
MakeOffsetRoundedPolygon :: proc "c" (#by_ptr hull: Hull, position: [2]f32, rotation: Rot, radius: f32) -> Polygon ---

Make an offset convex polygon from a convex hull. This will assert if the hull is not valid. @warning Do not manually fill in the hull data, it must come directly from b2ComputeHull

MakePolygon #

Source
MakePolygon :: proc "c" (#by_ptr hull: Hull, radius: f32) -> Polygon ---

Make a convex polygon from a convex hull. This will assert if the hull is not valid. @warning Do not manually fill in the hull data, it must come directly from b2ComputeHull

MakeProxy #

Source
@(require_results)
MakeProxy :: proc "c" (points: [][2]f32, radius: f32) -> ShapeProxy {…}

Make a proxy for use in overlap, shape cast, and related functions. This is a deep copy of the points.

MakeRot #

Source
@(require_results)
MakeRot :: proc "c" (angle: f32) -> Rot {…}

Make a rotation using an angle in radians

MakeRoundedBox #

Source
MakeRoundedBox :: proc "c" (halfWidth, halfHeight: f32, radius: f32) -> Polygon ---

Make a rounded box, bypassing the need for a convex hull.

MakeSquare #

Source
MakeSquare :: proc "c" (halfWidth: f32) -> Polygon ---

Make a square polygon, bypassing the need for a convex hull.

Max #

Source
@(require_results)
Max :: proc "c" (a, b: [2]f32) -> (c: [2]f32) {…}

Component-wise maximum vector

MaxFloat #

Source
@(deprecated="Prefer the built-in 'max(a, b)'")
@(require_results)
MaxFloat :: proc "c" (a, b: f32) -> f32 {…}

@return the maximum of two floats

MaxInt #

Source
@(deprecated="Prefer the built-in 'max(a, b)'")
@(require_results)
MaxInt :: proc "c" (a, b: i32) -> i32 {…}

@return the maximum of two integers

Min #

Source
@(require_results)
Min :: proc "c" (a, b: [2]f32) -> (c: [2]f32) {…}

Component-wise minimum vector

MinFloat #

Source
@(deprecated="Prefer the built-in 'min(a, b)'")
@(require_results)
MinFloat :: proc "c" (a, b: f32) -> f32 {…}

@return the minimum of two floats

MinInt #

Source
@(deprecated="Prefer the built-in 'min(a, b)'")
@(require_results)
MinInt :: proc "c" (a, b: i32) -> i32 {…}

@return the minimum of two integers

MotorJoint_GetAngularOffset #

Source
MotorJoint_GetAngularOffset :: proc "c" (jointId: JointId) -> f32 ---

Get the motor joint angular offset target in radians

MotorJoint_GetCorrectionFactor #

Source
MotorJoint_GetCorrectionFactor :: proc "c" (jointId: JointId) -> f32 ---

Get the motor joint correction factor, usually in [0, 1]

MotorJoint_GetLinearOffset #

Source
MotorJoint_GetLinearOffset :: proc "c" (jointId: JointId) -> [2]f32 ---

Get the motor joint linear offset target

MotorJoint_GetMaxForce #

Source
MotorJoint_GetMaxForce :: proc "c" (jointId: JointId) -> f32 ---

Get the motor joint maximum force, usually in newtons

MotorJoint_GetMaxTorque #

Source
MotorJoint_GetMaxTorque :: proc "c" (jointId: JointId) -> f32 ---

Get the motor joint maximum torque, usually in newton-meters

MotorJoint_SetAngularOffset #

Source
MotorJoint_SetAngularOffset :: proc "c" (jointId: JointId, angularOffset: f32) ---

Set the motor joint angular offset target in radians. This angle will be unwound so the motor will drive along the shortest arc.

MotorJoint_SetCorrectionFactor #

Source
MotorJoint_SetCorrectionFactor :: proc "c" (jointId: JointId, correctionFactor: f32) ---

Set the motor joint correction factor, usually in [0, 1]

MotorJoint_SetLinearOffset #

Source
MotorJoint_SetLinearOffset :: proc "c" (jointId: JointId, linearOffset: [2]f32) ---

Set the motor joint linear offset target

MotorJoint_SetMaxForce #

Source
MotorJoint_SetMaxForce :: proc "c" (jointId: JointId, maxForce: f32) ---

Set the motor joint maximum force, usually in newtons

MotorJoint_SetMaxTorque #

Source
MotorJoint_SetMaxTorque :: proc "c" (jointId: JointId, maxTorque: f32) ---

Set the motor joint maximum torque, usually in newton-meters

MouseJoint_GetMaxForce #

Source
MouseJoint_GetMaxForce :: proc "c" (jointId: JointId) -> f32 ---

Get the mouse joint maximum force, usually in newtons

MouseJoint_GetSpringDampingRatio #

Source
MouseJoint_GetSpringDampingRatio :: proc "c" (jointId: JointId) -> f32 ---

Get the mouse joint damping ratio, non-dimensional

MouseJoint_GetSpringHertz #

Source
MouseJoint_GetSpringHertz :: proc "c" (jointId: JointId) -> f32 ---

Get the mouse joint spring stiffness in Hertz

MouseJoint_GetTarget #

Source
MouseJoint_GetTarget :: proc "c" (jointId: JointId) -> [2]f32 ---

Get the mouse joint target

MouseJoint_SetMaxForce #

Source
MouseJoint_SetMaxForce :: proc "c" (jointId: JointId, maxForce: f32) ---

Set the mouse joint maximum force, usually in newtons

MouseJoint_SetSpringDampingRatio #

Source
MouseJoint_SetSpringDampingRatio :: proc "c" (jointId: JointId, dampingRatio: f32) ---

Set the mouse joint spring damping ratio, non-dimensional

MouseJoint_SetSpringHertz #

Source
MouseJoint_SetSpringHertz :: proc "c" (jointId: JointId, hertz: f32) ---

Set the mouse joint spring stiffness in Hertz

MouseJoint_SetTarget #

Source
MouseJoint_SetTarget :: proc "c" (jointId: JointId, target: [2]f32) ---

Set the mouse joint target

Mul #

Source
@(deprecated="Prefer 'a * b'")
@(require_results)
Mul :: proc "c" (a, b: [2]f32) -> [2]f32 {…}

Component-wise multiplication

MulAdd #

Source
@(deprecated="Prefer 'a + s * b'")
@(require_results)
MulAdd :: proc "c" (a: [2]f32, s: f32, b: [2]f32) -> [2]f32 {…}

a + s * b

MulMV #

Source
@(deprecated="Prefer 'A * v'")
@(require_results)
MulMV :: proc "c" (A: matrix[2, 2]f32, v: [2]f32) -> [2]f32 {…}

Multiply a 2-by-2 matrix times a 2D vector

MulRot #

Source
@(require_results)
MulRot :: proc "c" (q, r: Rot) -> (qr: Rot) {…}

Multiply two rotations: q * r

MulSub #

Source
@(deprecated="Prefer 'a - s * b'")
@(require_results)
MulSub :: proc "c" (a: [2]f32, s: f32, b: [2]f32) -> [2]f32 {…}

a - s * b

MulSV #

Source
@(deprecated="Prefer 's * v'")
@(require_results)
MulSV :: proc "c" (s: f32, v: [2]f32) -> [2]f32 {…}

Multiply a scalar and vector

MulTransforms #

Source
@(require_results)
MulTransforms :: proc "c" (A, B: Transform) -> (C: Transform) {…}

Multiply two transforms. If the result is applied to a point p local to frame B, the transform would first convert p to a point local to frame A, then into a point in the world frame. v2 = A.q.Rot(B.q.Rot(v1) + B.p) + A.p = (A.q * B.q).Rot(v1) + A.q.Rot(B.p) + A.p

Neg #

Source
@(deprecated="Prefer '-a'")
@(require_results)
Neg :: proc "c" (a: [2]f32) -> [2]f32 {…}

Vector negation

NLerp #

Source
@(require_results)
NLerp :: proc "c" (q1: Rot, q2: Rot, t: f32) -> Rot {…}

Normalized linear interpolation https://fgiesen.wordpress.com/2012/08/15/linear-interpolation-past-present-and-future/ https://web.archive.org/web/20170825184056/http://number-none.com/product/Understanding%20Slerp,%20Then%20Not%20Using%20It/

NormalizeRot #

Source
@(require_results)
NormalizeRot :: proc "c" (q: Rot) -> Rot {…}

Normalize rotation

PlaneSeparation #

Source
@(require_results)
PlaneSeparation :: proc "c" (plane: Plane, point: [2]f32) -> f32 {…}

Signed separation of a point from a plane

PointInCapsule #

Source
PointInCapsule :: proc "c" (point: [2]f32, #by_ptr shape: Capsule) -> bool ---

Test a point for overlap with a capsule in local space

PointInCircle #

Source
PointInCircle :: proc "c" (point: [2]f32, #by_ptr shape: Circle) -> bool ---

Test a point for overlap with a circle in local space

PointInPolygon #

Source
PointInPolygon :: proc "c" (point: [2]f32, #by_ptr shape: Polygon) -> bool ---

Test a point for overlap with a convex polygon in local space

PrismaticJoint_EnableLimit #

Source
PrismaticJoint_EnableLimit :: proc "c" (jointId: JointId, enableLimit: bool) ---

Enable/disable a prismatic joint limit

PrismaticJoint_EnableMotor #

Source
PrismaticJoint_EnableMotor :: proc "c" (jointId: JointId, enableMotor: bool) ---

Enable/disable a prismatic joint motor

PrismaticJoint_EnableSpring #

Source
PrismaticJoint_EnableSpring :: proc "c" (jointId: JointId, enableSpring: bool) ---

Enable/disable the joint spring.

PrismaticJoint_GetLowerLimit #

Source
PrismaticJoint_GetLowerLimit :: proc "c" (jointId: JointId) -> f32 ---

Get the prismatic joint lower limit

PrismaticJoint_GetMaxMotorForce #

Source
PrismaticJoint_GetMaxMotorForce :: proc "c" (jointId: JointId) -> f32 ---

Get the prismatic joint maximum motor force, usually in newtons

PrismaticJoint_GetMotorForce #

Source
PrismaticJoint_GetMotorForce :: proc "c" (jointId: JointId) -> f32 ---

Get the prismatic joint current motor force, usually in newtons

PrismaticJoint_GetMotorSpeed #

Source
PrismaticJoint_GetMotorSpeed :: proc "c" (jointId: JointId) -> f32 ---

Get the prismatic joint motor speed, usually in meters per second

PrismaticJoint_GetSpeed #

Source
PrismaticJoint_GetSpeed :: proc "c" (jointId: JointId) -> f32 ---

Get the current joint translation speed, usually in meters per second.

PrismaticJoint_GetSpringDampingRatio #

Source
PrismaticJoint_GetSpringDampingRatio :: proc "c" (jointId: JointId) -> f32 ---

Get the prismatic spring damping ratio (non-dimensional)

PrismaticJoint_GetSpringHertz #

Source
PrismaticJoint_GetSpringHertz :: proc "c" (jointId: JointId) -> f32 ---

Get the prismatic joint stiffness in Hertz

PrismaticJoint_GetTargetTranslation #

Source
PrismaticJoint_GetTargetTranslation :: proc "c" (jointId: JointId) -> f32 ---

Get the prismatic joint sprint target translation, usually in meters

PrismaticJoint_GetTranslation #

Source
PrismaticJoint_GetTranslation :: proc "c" (jointId: JointId) -> f32 ---

Get the current joint translation, usually in meters.

PrismaticJoint_GetUpperLimit #

Source
PrismaticJoint_GetUpperLimit :: proc "c" (jointId: JointId) -> f32 ---

Get the prismatic joint upper limit

PrismaticJoint_IsLimitEnabled #

Source
PrismaticJoint_IsLimitEnabled :: proc "c" (jointId: JointId) -> bool ---

Is the prismatic joint limit enabled?

PrismaticJoint_IsMotorEnabled #

Source
PrismaticJoint_IsMotorEnabled :: proc "c" (jointId: JointId) -> bool ---

Is the prismatic joint motor enabled?

PrismaticJoint_IsSpringEnabled #

Source
PrismaticJoint_IsSpringEnabled :: proc "c" (jointId: JointId) -> bool ---

Is the prismatic joint spring enabled or not?

PrismaticJoint_SetLimits #

Source
PrismaticJoint_SetLimits :: proc "c" (jointId: JointId, lower, upper: f32) ---

Set the prismatic joint limits

PrismaticJoint_SetMaxMotorForce #

Source
PrismaticJoint_SetMaxMotorForce :: proc "c" (jointId: JointId, force: f32) ---

Set the prismatic joint maximum motor force, usually in newtons

PrismaticJoint_SetMotorSpeed #

Source
PrismaticJoint_SetMotorSpeed :: proc "c" (jointId: JointId, motorSpeed: f32) ---

Set the prismatic joint motor speed, usually in meters per second

PrismaticJoint_SetSpringDampingRatio #

Source
PrismaticJoint_SetSpringDampingRatio :: proc "c" (jointId: JointId, dampingRatio: f32) ---

Set the prismatic joint damping ratio (non-dimensional)

PrismaticJoint_SetSpringHertz #

Source
PrismaticJoint_SetSpringHertz :: proc "c" (jointId: JointId, hertz: f32) ---

Set the prismatic joint stiffness in Hertz. This should usually be less than a quarter of the simulation rate. For example, if the simulation runs at 60Hz then the joint stiffness should be 15Hz or less.

PrismaticJoint_SetTargetTranslation #

Source
PrismaticJoint_SetTargetTranslation :: proc "c" (jointId: JointId, translation: f32) ---

Set the prismatic joint sprint target angle, usually in meters

RayCastSegment #

Source
RayCastSegment :: proc "c" (#by_ptr input: RayCastInput, #by_ptr shape: Segment, oneSided: bool) -> CastOutput ---

Ray cast versus segment in shape local space. Optionally treat the segment as one-sided with hits from the left side being treated as a miss.

RelativeAngle #

Source
@(require_results)
RelativeAngle :: proc "c" (b, a: Rot) -> f32 {…}

relative angle between b and a (rot_b * inv(rot_a))

RevoluteJoint_EnableLimit #

Source
RevoluteJoint_EnableLimit :: proc "c" (jointId: JointId, enableLimit: bool) ---

Enable/disable the revolute joint limit

RevoluteJoint_EnableMotor #

Source
RevoluteJoint_EnableMotor :: proc "c" (jointId: JointId, enableMotor: bool) ---

Enable/disable a revolute joint motor

RevoluteJoint_EnableSpring #

Source
RevoluteJoint_EnableSpring :: proc "c" (jointId: JointId, enableSpring: bool) ---

Enable/disable the revolute joint spring

RevoluteJoint_GetAngle #

Source
RevoluteJoint_GetAngle :: proc "c" (jointId: JointId) -> f32 ---

Get the revolute joint current angle in radians relative to the reference angle @see b2RevoluteJointDef::referenceAngle

RevoluteJoint_GetLowerLimit #

Source
RevoluteJoint_GetLowerLimit :: proc "c" (jointId: JointId) -> f32 ---

Get the revolute joint lower limit in radians

RevoluteJoint_GetMaxMotorTorque #

Source
RevoluteJoint_GetMaxMotorTorque :: proc "c" (jointId: JointId) -> f32 ---

Get the revolute joint maximum motor torque, usually in newton-meters

RevoluteJoint_GetMotorSpeed #

Source
RevoluteJoint_GetMotorSpeed :: proc "c" (jointId: JointId) -> f32 ---

Get the revolute joint motor speed in radians per second

RevoluteJoint_GetMotorTorque #

Source
RevoluteJoint_GetMotorTorque :: proc "c" (jointId: JointId) -> f32 ---

Get the revolute joint current motor torque, usually in newton-meters

RevoluteJoint_GetSpringDampingRatio #

Source
RevoluteJoint_GetSpringDampingRatio :: proc "c" (jointId: JointId) -> f32 ---

Get the revolute joint spring damping ratio, non-dimensional

RevoluteJoint_GetSpringHertz #

Source
RevoluteJoint_GetSpringHertz :: proc "c" (jointId: JointId) -> f32 ---

Get the revolute joint spring stiffness in Hertz

RevoluteJoint_GetTargetAngle #

Source
RevoluteJoint_GetTargetAngle :: proc "c" (jointId: JointId) -> f32 ---

Get the revolute joint spring target angle, radians

RevoluteJoint_GetUpperLimit #

Source
RevoluteJoint_GetUpperLimit :: proc "c" (jointId: JointId) -> f32 ---

Get the revolute joint upper limit in radians

RevoluteJoint_IsLimitEnabled #

Source
RevoluteJoint_IsLimitEnabled :: proc "c" (jointId: JointId) -> bool ---

Is the revolute joint limit enabled?

RevoluteJoint_IsMotorEnabled #

Source
RevoluteJoint_IsMotorEnabled :: proc "c" (jointId: JointId) -> bool ---

Is the revolute joint motor enabled?

RevoluteJoint_IsSpringEnabled #

Source
RevoluteJoint_IsSpringEnabled :: proc "c" (jointId: JointId) -> bool ---

Is the revolute spring enabled?

RevoluteJoint_SetLimits #

Source
RevoluteJoint_SetLimits :: proc "c" (jointId: JointId, lower, upper: f32) ---

Set the revolute joint limits in radians. It is expected that lower <= upper and that -0.99 * B2_PI <= lower && upper <= -0.99 * B2_PI.

RevoluteJoint_SetMaxMotorTorque #

Source
RevoluteJoint_SetMaxMotorTorque :: proc "c" (jointId: JointId, torque: f32) ---

Set the revolute joint maximum motor torque, usually in newton-meters

RevoluteJoint_SetMotorSpeed #

Source
RevoluteJoint_SetMotorSpeed :: proc "c" (jointId: JointId, motorSpeed: f32) ---

Set the revolute joint motor speed in radians per second

RevoluteJoint_SetSpringDampingRatio #

Source
RevoluteJoint_SetSpringDampingRatio :: proc "c" (jointId: JointId, dampingRatio: f32) ---

Set the revolute joint spring damping ratio, non-dimensional

RevoluteJoint_SetSpringHertz #

Source
RevoluteJoint_SetSpringHertz :: proc "c" (jointId: JointId, hertz: f32) ---

Set the revolute joint spring stiffness in Hertz

RevoluteJoint_SetTargetAngle #

Source
RevoluteJoint_SetTargetAngle :: proc "c" (jointId: JointId, angle: f32) ---

Set the revolute joint spring target angle, radians

RightPerp #

Source
@(require_results)
RightPerp :: proc "c" (v: [2]f32) -> [2]f32 {…}

Get a right pointing perpendicular vector. Equivalent to b2CrossVS(v, 1)

Rot_GetAngle #

Source
@(require_results)
Rot_GetAngle :: proc "c" (q: Rot) -> f32 {…}

Get the angle in radians in the range [-pi, pi]

Rot_GetXAxis #

Source
@(require_results)
Rot_GetXAxis :: proc "c" (q: Rot) -> [2]f32 {…}

Get the x-axis

Rot_GetYAxis #

Source
@(require_results)
Rot_GetYAxis :: proc "c" (q: Rot) -> [2]f32 {…}

Get the y-axis

RotateVector #

Source
@(require_results)
RotateVector :: proc "c" (q: Rot, v: [2]f32) -> [2]f32 {…}

Rotate a vector

SetAllocator #

Source
SetAllocator :: proc "c" (allocFcn: AllocFcn, freefcn: FreeFcn) ---

This allows the user to override the allocation functions. These should be set during application startup.

SetAssertFcn #

Source
SetAssertFcn :: proc "c" (assertfcn: AssertFcn) ---

Override the default assert callback @param assertFcn a non-null assert callback

SetLengthUnitsPerMeter #

Source
SetLengthUnitsPerMeter :: proc "c" (lengthUnits: f32) ---

Box2D bases all length units on meters, but you may need different units for your game. You can set this value to use different units. This should be done at application startup and only modified once. Default value is 1. For example, if your game uses pixels for units you can use pixels for all length values sent to Box2D. There should be no extra cost. However, Box2D has some internal tolerances and thresholds that have been tuned for meters. By calling this function, Box2D is able to adjust those tolerances and thresholds to improve accuracy. A good rule of thumb is to pass the height of your player character to this function. So if your player character is 32 pixels high, then pass 32 to this function. Then you may confidently use pixels for all the length values sent to Box2D. All length values returned from Box2D will also be pixels because Box2D does not do any scaling internally. However, you are now on the hook for coming up with good values for gravity, density, and forces. @warning This must be modified before any calls to Box2D

Shape_AreContactEventsEnabled #

Source
Shape_AreContactEventsEnabled :: proc "c" (shapeId: ShapeId) -> bool ---

Returns true if contact events are enabled

Shape_AreHitEventsEnabled #

Source
Shape_AreHitEventsEnabled :: proc "c" (shapeId: ShapeId) -> bool ---

Returns true if hit events are enabled

Shape_ArePreSolveEventsEnabled #

Source
Shape_ArePreSolveEventsEnabled :: proc "c" (shapeId: ShapeId) -> bool ---

Returns true if pre-solve events are enabled

Shape_AreSensorEventsEnabled #

Source
Shape_AreSensorEventsEnabled :: proc "c" (shapeId: ShapeId) -> bool ---

Returns true if sensor events are enabled

Shape_EnableContactEvents #

Source
Shape_EnableContactEvents :: proc "c" (shapeId: ShapeId, flag: bool) ---

Enable contact events for this shape. Only applies to kinematic and dynamic bodies. Ignored for sensors. @see b2ShapeDef::enableContactEvents @warning changing this at run-time may lead to lost begin/end events

Shape_EnableHitEvents #

Source
Shape_EnableHitEvents :: proc "c" (shapeId: ShapeId, flag: bool) ---

Enable contact hit events for this shape. Ignored for sensors. @see WorldDef.hitEventThreshold

Shape_EnablePreSolveEvents #

Source
Shape_EnablePreSolveEvents :: proc "c" (shapeId: ShapeId, flag: bool) ---

Enable pre-solve contact events for this shape. Only applies to dynamic bodies. These are expensive and must be carefully handled due to multithreading. Ignored for sensors. @see b2PreSolveFcn

Shape_EnableSensorEvents #

Source
Shape_EnableSensorEvents :: proc "c" (shapeId: ShapeId, flag: bool) ---

Enable sensor events for this shape. @see b2ShapeDef::enableSensorEvents

Shape_GetCapsule #

Source
Shape_GetCapsule :: proc "c" (shapeId: ShapeId) -> Capsule ---

Get a copy of the shape's capsule. Asserts the type is correct.

Shape_GetChainSegment #

Source
Shape_GetChainSegment :: proc "c" (shapeId: ShapeId) -> ChainSegment ---

Get a copy of the shape's chain segment. These come from chain shapes. Asserts the type is correct.

Shape_GetCircle #

Source
Shape_GetCircle :: proc "c" (shapeId: ShapeId) -> Circle ---

Get a copy of the shape's circle. Asserts the type is correct.

Shape_GetClosestPoint #

Source
Shape_GetClosestPoint :: proc "c" (shapeId: ShapeId, target: [2]f32) -> [2]f32 ---

Get the closest point on a shape to a target point. Target and result are in world space.

Shape_GetContactCapacity #

Source
Shape_GetContactCapacity :: proc "c" (shapeId: ShapeId) -> i32 ---

Get the maximum capacity required for retrieving all the touching contacts on a shape

Shape_GetContactData #

Source
@(require_results)
Shape_GetContactData :: proc "c" (shapeId: ShapeId, contactData: []ContactData) -> []ContactData {…}

Get the touching contact data for a shape. The provided shapeId will be either shapeIdA or shapeIdB on the contact data.

Shape_GetDensity #

Source
Shape_GetDensity :: proc "c" (shapeId: ShapeId) -> f32 ---

Get the density of a shape, usually in kg/m^2

Shape_GetMaterial #

Source
Shape_GetMaterial :: proc "c" (shapeId: ShapeId) -> i32 ---

Get the shape material identifier

Shape_GetParentChain #

Source
Shape_GetParentChain :: proc "c" (shapeId: ShapeId) -> ChainId ---

Get the parent chain id if the shape type is a chain segment, otherwise returns b2_nullChainId.

Shape_GetPolygon #

Source
Shape_GetPolygon :: proc "c" (shapeId: ShapeId) -> Polygon ---

Get a copy of the shape's convex polygon. Asserts the type is correct.

Shape_GetSegment #

Source
Shape_GetSegment :: proc "c" (shapeId: ShapeId) -> Segment ---

Get a copy of the shape's line segment. Asserts the type is correct.

Shape_GetSensorCapacity #

Source
Shape_GetSensorCapacity :: proc "c" (shapeId: ShapeId) -> i32 ---

Get the maximum capacity required for retrieving all the overlapped shapes on a sensor shape. This returns 0 if the provided shape is not a sensor. @param shapeId the id of a sensor shape @returns the required capacity to get all the overlaps in b2Shape_GetSensorOverlaps

Shape_GetSensorOverlaps #

Source
Shape_GetSensorOverlaps :: proc "c" (shapeId: ShapeId, overlaps: [^]ShapeId, capacity: i32) -> i32 ---

Get the overlapped shapes for a sensor shape. @param shapeId the id of a sensor shape @param overlaps a user allocated array that is filled with the overlapping shapes @param capacity the capacity of overlappedShapes @returns the number of elements filled in the provided array @warning do not ignore the return value, it specifies the valid number of elements @warning overlaps may contain destroyed shapes so use b2Shape_IsValid to confirm each overlap

Shape_GetUserData #

Source
Shape_GetUserData :: proc "c" (shapeId: ShapeId) -> rawptr ---

Get the user data for a shape. This is useful when you get a shape id from an event or query.

Shape_IsSensor #

Source
Shape_IsSensor :: proc "c" (shapeId: ShapeId) -> bool ---

Returns true if the shape is a sensor. It is not possible to change a shape from sensor to solid dynamically because this breaks the contract for sensor events.

Shape_IsValid #

Source
Shape_IsValid :: proc "c" (id: ShapeId) -> bool ---

Shape identifier validation. Provides validation for up to 64K allocations.

Shape_SetCapsule #

Source
Shape_SetCapsule :: proc "c" (shapeId: ShapeId, #by_ptr capsule: Capsule) ---

Allows you to change a shape to be a capsule or update the current capsule. This does not modify the mass properties. @see b2Body_ApplyMassFromShapes

Shape_SetCircle #

Source
Shape_SetCircle :: proc "c" (shapeId: ShapeId, #by_ptr circle: Circle) ---

Allows you to change a shape to be a circle or update the current circle. This does not modify the mass properties. @see b2Body_ApplyMassFromShapes

Shape_SetDensity #

Source
Shape_SetDensity :: proc "c" (shapeId: ShapeId, density: f32, updateBodyMass: bool) ---

Set the mass density of a shape, usually in kg/m^2. This will optionally update the mass properties on the parent body. @see b2ShapeDef::density, b2Body_ApplyMassFromShapes

Shape_SetFilter #

Source
Shape_SetFilter :: proc "c" (shapeId: ShapeId, filter: Filter) ---

Set the current filter. This is almost as expensive as recreating the shape. This may cause contacts to be immediately destroyed. However contacts are not created until the next world step. Sensor overlap state is also not updated until the next world step. @see b2ShapeDef::filter

Shape_SetFriction #

Source
Shape_SetFriction :: proc "c" (shapeId: ShapeId, friction: f32) ---

Set the friction on a shape @see b2ShapeDef::friction

Shape_SetMaterial #

Source
Shape_SetMaterial :: proc "c" (shapeId: ShapeId, material: i32) ---

Set the shape material identifier @see b2ShapeDef::material

Shape_SetPolygon #

Source
Shape_SetPolygon :: proc "c" (shapeId: ShapeId, #by_ptr polygon: Polygon) ---

Allows you to change a shape to be a polygon or update the current polygon. This does not modify the mass properties. @see b2Body_ApplyMassFromShapes

Shape_SetRestitution #

Source
Shape_SetRestitution :: proc "c" (shapeId: ShapeId, restitution: f32) ---

Set the shape restitution (bounciness) @see b2ShapeDef::restitution

Shape_SetSegment #

Source
Shape_SetSegment :: proc "c" (shapeId: ShapeId, #by_ptr segment: Segment) ---

Allows you to change a shape to be a segment or update the current segment.

ShapeCast #

Source
ShapeCast :: proc "c" (#by_ptr input: ShapeCastPairInput) -> CastOutput ---

Perform a linear shape cast of shape B moving and shape A fixed. Determines the hit point, normal, and translation fraction. Initially touching shapes are treated as a miss.

ShapeDistance #

Source
@(require_results)
ShapeDistance :: proc "c" (#by_ptr input: DistanceInput, cache: ^SimplexCache, simplexes: []Simplex) -> DistanceOutput {…}

Compute the closest points between two shapes represented as point clouds. SimplexCache cache is input/output. On the first call set SimplexCache.count to zero. The underlying GJK algorithm may be debugged by passing in debug simplexes and capacity. You may pass in NULL and 0 for these.

Solve22 #

Source
@(require_results)
Solve22 :: proc "c" (A: matrix[2, 2]f32, b: [2]f32) -> [2]f32 {…}

Solve A * x = b, where b is a column vector. This is more efficient than computing the inverse in one-shot cases.

Sub #

Source
@(deprecated="Prefer 'a - b'")
@(require_results)
Sub :: proc "c" (a, b: [2]f32) -> [2]f32 {…}

Vector subtraction

TimeOfImpact #

Source
TimeOfImpact :: proc "c" (#by_ptr input: TOIInput) -> TOIOutput ---

Compute the upper bound on time before two shapes penetrate. Time is represented as a fraction between [0,tMax]. This uses a swept separating axis and may miss some intermediate, non-tunneling collisions. If you change the time interval, you should call this function again.

TransformPoint #

Source
@(require_results)
TransformPoint :: proc "c" (t: Transform, p: [2]f32) -> [2]f32 {…}

Transform a point (e.g. local space to world space)

TransformPolygon #

Source
TransformPolygon :: proc "c" (transform: Transform, #by_ptr polygon: Polygon) -> Polygon ---

Transform a polygon. This is useful for transferring a shape from one body to another.

UnwindAngle #

Source
@(require_results)
UnwindAngle :: proc "c" (radians: f32) -> f32 {…}

Convert any angle into the range [-pi, pi]

ValidateHull #

Source
ValidateHull :: proc "c" (#by_ptr hull: Hull) -> bool ---

This determines if a hull is valid. Checks for: - convexity - collinear points This is expensive and should not be called at runtime.

WeldJoint_GetAngularDampingRatio #

Source
WeldJoint_GetAngularDampingRatio :: proc "c" (jointId: JointId) -> f32 ---

Get the weld joint angular damping ratio, non-dimensional

WeldJoint_GetAngularHertz #

Source
WeldJoint_GetAngularHertz :: proc "c" (jointId: JointId) -> f32 ---

Get the weld joint angular stiffness in Hertz

WeldJoint_GetLinearDampingRatio #

Source
WeldJoint_GetLinearDampingRatio :: proc "c" (jointId: JointId) -> f32 ---

Get the weld joint linear damping ratio (non-dimensional)

WeldJoint_GetLinearHertz #

Source
WeldJoint_GetLinearHertz :: proc "c" (jointId: JointId) -> f32 ---

Get the weld joint linear stiffness in Hertz

WeldJoint_SetAngularDampingRatio #

Source
WeldJoint_SetAngularDampingRatio :: proc "c" (jointId: JointId, dampingRatio: f32) ---

Set weld joint angular damping ratio, non-dimensional

WeldJoint_SetAngularHertz #

Source
WeldJoint_SetAngularHertz :: proc "c" (jointId: JointId, hertz: f32) ---

Set the weld joint angular stiffness in Hertz. 0 is rigid.

WeldJoint_SetLinearDampingRatio #

Source
WeldJoint_SetLinearDampingRatio :: proc "c" (jointId: JointId, dampingRatio: f32) ---

Set the weld joint linear damping ratio (non-dimensional)

WeldJoint_SetLinearHertz #

Source
WeldJoint_SetLinearHertz :: proc "c" (jointId: JointId, hertz: f32) ---

Set the weld joint linear stiffness in Hertz. 0 is rigid.

WheelJoint_EnableLimit #

Source
WheelJoint_EnableLimit :: proc "c" (jointId: JointId, enableLimit: bool) ---

Enable/disable the wheel joint limit

WheelJoint_EnableMotor #

Source
WheelJoint_EnableMotor :: proc "c" (jointId: JointId, enableMotor: bool) ---

Enable/disable the wheel joint motor

WheelJoint_EnableSpring #

Source
WheelJoint_EnableSpring :: proc "c" (jointId: JointId, enableSpring: bool) ---

Enable/disable the wheel joint spring

WheelJoint_GetLowerLimit #

Source
WheelJoint_GetLowerLimit :: proc "c" (jointId: JointId) -> f32 ---

Get the wheel joint lower limit

WheelJoint_GetMaxMotorTorque #

Source
WheelJoint_GetMaxMotorTorque :: proc "c" (jointId: JointId) -> f32 ---

Get the wheel joint maximum motor torque, usually in newton-meters

WheelJoint_GetMotorSpeed #

Source
WheelJoint_GetMotorSpeed :: proc "c" (jointId: JointId) -> f32 ---

Get the wheel joint motor speed in radians per second

WheelJoint_GetMotorTorque #

Source
WheelJoint_GetMotorTorque :: proc "c" (jointId: JointId) -> f32 ---

Get the wheel joint current motor torque, usually in newton-meters

WheelJoint_GetSpringDampingRatio #

Source
WheelJoint_GetSpringDampingRatio :: proc "c" (jointId: JointId) -> f32 ---

Get the wheel joint damping ratio, non-dimensional

WheelJoint_GetSpringHertz #

Source
WheelJoint_GetSpringHertz :: proc "c" (jointId: JointId) -> f32 ---

Get the wheel joint stiffness in Hertz

WheelJoint_GetUpperLimit #

Source
WheelJoint_GetUpperLimit :: proc "c" (jointId: JointId) -> f32 ---

Get the wheel joint upper limit

WheelJoint_IsLimitEnabled #

Source
WheelJoint_IsLimitEnabled :: proc "c" (jointId: JointId) -> bool ---

Is the wheel joint limit enabled?

WheelJoint_IsMotorEnabled #

Source
WheelJoint_IsMotorEnabled :: proc "c" (jointId: JointId) -> bool ---

Is the wheel joint motor enabled?

WheelJoint_IsSpringEnabled #

Source
WheelJoint_IsSpringEnabled :: proc "c" (jointId: JointId) -> bool ---

Is the wheel joint spring enabled?

WheelJoint_SetLimits #

Source
WheelJoint_SetLimits :: proc "c" (jointId: JointId, lower, upper: f32) ---

Set the wheel joint limits

WheelJoint_SetMaxMotorTorque #

Source
WheelJoint_SetMaxMotorTorque :: proc "c" (jointId: JointId, torque: f32) ---

Set the wheel joint maximum motor torque, usually in newton-meters

WheelJoint_SetMotorSpeed #

Source
WheelJoint_SetMotorSpeed :: proc "c" (jointId: JointId, motorSpeed: f32) ---

Set the wheel joint motor speed in radians per second

WheelJoint_SetSpringDampingRatio #

Source
WheelJoint_SetSpringDampingRatio :: proc "c" (jointId: JointId, dampingRatio: f32) ---

Set the wheel joint damping ratio, non-dimensional

WheelJoint_SetSpringHertz #

Source
WheelJoint_SetSpringHertz :: proc "c" (jointId: JointId, hertz: f32) ---

Set the wheel joint stiffness in Hertz

World_CastMover #

Source
World_CastMover :: proc "c" (worldId: WorldId, #by_ptr mover: Capsule, translation: [2]f32, filter: QueryFilter) -> f32 ---

Cast a capsule mover through the world. This is a special shape cast that handles sliding along other shapes while reducing clipping.

World_CastRay #

Source
World_CastRay :: proc "c" (
	worldId:     WorldId, 
	origin:      [2]f32, 
	translation: [2]f32, 
	filter:      QueryFilter, 
	fcn:         CastResultFcn, 
	ctx:         rawptr, 
) -> TreeStats ---

Cast a ray into the world to collect shapes in the path of the ray. Your callback function controls whether you get the closest point, any point, or n-points. @note The callback function may receive shapes in any order @param worldId The world to cast the ray against @param origin The start point of the ray @param translation The translation of the ray from the start point to the end point @param filter Contains bit flags to filter unwanted shapes from the results @param fcn A user implemented callback function @param context A user context that is passed along to the callback function @return traversal performance counters

World_CastRayClosest #

Source
World_CastRayClosest :: proc "c" (worldId: WorldId, origin: [2]f32, translation: [2]f32, filter: QueryFilter) -> RayResult ---

Cast a ray into the world to collect the closest hit. This is a convenience function. Ignores initial overlap. This is less general than b2World_CastRay() and does not allow for custom filtering.

World_CollideMover #

Source
World_CollideMover :: proc "c" (worldId: WorldId, #by_ptr mover: Capsule, filter: QueryFilter, fcn: PlaneResultFcn, ctx: rawptr) ---

Collide a capsule mover with the world, gathering collision planes that can be fed to b2SolvePlanes. Useful for kinematic character movement.

World_DumpMemoryStats #

Source
World_DumpMemoryStats :: proc "c" (worldId: WorldId) ---

Dump memory stats to box2d_memory.txt

World_EnableContinuous #

Source
World_EnableContinuous :: proc "c" (worldId: WorldId, flag: bool) ---

Enable/disable continuous collision between dynamic and static bodies. Generally you should keep continuous collision enabled to prevent fast moving objects from going through static objects. The performance gain from disabling continuous collision is minor. @see WorldDef

World_EnableSleeping #

Source
World_EnableSleeping :: proc "c" (worldId: WorldId, flag: bool) ---

Enable/disable sleep. If your application does not need sleeping, you can gain some performance by disabling sleep completely at the world level. @see WorldDef

World_EnableSpeculative #

Source
World_EnableSpeculative :: proc "c" (worldId: WorldId, flag: bool) ---

This is for internal testing

World_EnableWarmStarting #

Source
World_EnableWarmStarting :: proc "c" (worldId: WorldId, flag: bool) ---

Enable/disable constraint warm starting. Advanced feature for testing. Disabling warm starting greatly reduces stability and provides no performance gain.

World_Explode #

Source
World_Explode :: proc "c" (worldId: WorldId, #by_ptr explosionDef: ExplosionDef) ---

Apply a radial explosion @param worldId The world id @param explosionDef The explosion definition

World_GetAwakeBodyCount #

Source
World_GetAwakeBodyCount :: proc "c" (worldId: WorldId) -> i32 ---

Get the number of awake bodies.

World_GetBodyEvents #

Source
World_GetBodyEvents :: proc "c" (worldId: WorldId) -> BodyEvents ---

Get the body events for the current time step. The event data is transient. Do not store a reference to this data.

World_GetContactEvents #

Source
World_GetContactEvents :: proc "c" (worldId: WorldId) -> ContactEvents ---

Get contact events for this current time step. The event data is transient. Do not store a reference to this data.

World_GetHitEventThreshold #

Source
World_GetHitEventThreshold :: proc "c" (worldId: WorldId) -> f32 ---

Get the hit event speed threshold. Usually in meters per second.

World_GetMaximumLinearSpeed #

Source
World_GetMaximumLinearSpeed :: proc "c" (worldId: WorldId) -> f32 ---

Get the maximum linear speed. Usually in m/s.

World_GetRestitutionThreshold #

Source
World_GetRestitutionThreshold :: proc "c" (worldId: WorldId) -> f32 ---

Get the restitution speed threshold. Usually in meters per second.

World_GetSensorEvents #

Source
World_GetSensorEvents :: proc "c" (worldId: WorldId) -> SensorEvents ---

Get sensor events for the current time step. The event data is transient. Do not store a reference to this data.

World_IsContinuousEnabled #

Source
World_IsContinuousEnabled :: proc "c" (worldId: WorldId) -> bool ---

Is continuous collision enabled?

World_IsSleepingEnabled #

Source
World_IsSleepingEnabled :: proc "c" (worldId: WorldId) -> bool ---

Is body sleeping enabled?

World_IsValid #

Source
World_IsValid :: proc "c" (id: WorldId) -> bool ---

World id validation. Provides validation for up to 64K allocations.

World_IsWarmStartingEnabled #

Source
World_IsWarmStartingEnabled :: proc "c" (worldId: WorldId) -> bool ---

Is constraint warm starting enabled?

World_RebuildStaticTree #

Source
World_RebuildStaticTree :: proc "c" (worldId: WorldId) ---

This is for internal testing

World_SetContactTuning #

Source
World_SetContactTuning :: proc "c" (worldId: WorldId, hertz: f32, dampingRatio: f32, pushSpeed: f32) ---

Adjust contact tuning parameters @param worldId The world id @param hertz The contact stiffness (cycles per second) @param dampingRatio The contact bounciness with 1 being critical damping (non-dimensional) @param pushSpeed The maximum contact constraint push out speed (meters per second) @note Advanced feature

World_SetGravity #

Source
World_SetGravity :: proc "c" (worldId: WorldId, gravity: [2]f32) ---

Set the gravity vector for the entire world. Box2D has no concept of an up direction and this is left as a decision for the application. Usually in m/s^2. @see WorldDef

World_SetHitEventThreshold #

Source
World_SetHitEventThreshold :: proc "c" (worldId: WorldId, value: f32) ---

Adjust the hit event threshold. This controls the collision velocity needed to generate a b2ContactHitEvent. Usually in meters per second. @see WorldDef::hitEventThreshold

World_SetMaximumLinearSpeed #

Source
World_SetMaximumLinearSpeed :: proc "c" (worldId: WorldId, maximumLinearSpeed: f32) ---

Set the maximum linear speed. Usually in m/s.

World_SetRestitutionThreshold #

Source
World_SetRestitutionThreshold :: proc "c" (worldId: WorldId, value: f32) ---

Adjust the restitution threshold. It is recommended not to make this value very small because it will prevent bodies from sleeping. Usually in meters per second. @see WorldDef

World_Step #

Source
World_Step :: proc "c" (worldId: WorldId, timeStep: f32, subStepCount: i32) ---

Simulate a world for one time step. This performs collision detection, integration, and constraint solution. @param worldId The world to simulate @param timeStep The amount of time to simulate, this should be a fixed number. Usually 1/60. @param subStepCount The number of sub-steps, increasing the sub-step count can increase accuracy. Usually 4.

Yield #

Source
Yield :: proc "c" () ---

Yield to be used in a busy loop.

Procedure Groups

1