package vendor:box2d

⌘K
Ctrl+K
or
/

    Index

    Types (82)
    Variables (0)

    This section is empty.

    Procedures (417)
    Procedure Groups (1)

    Types

    AllocFcn ¶

    AllocFcn :: proc "c" (size: u32, alignment: i32) -> rawptr
     

    Prototype for user allocation function

    @param size the allocation size in bytes
    @param alignment the required alignment, guaranteed to be a power of 2
    
    Related Procedures With Parameters

    AssertFcn ¶

    AssertFcn :: proc "c" (condition, file_name: cstring, line_number: i32) -> i32
     

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

    Related Procedures With Parameters

    BodyDef ¶

    BodyDef :: struct {
    	// The body type: static, kinematic, or dynamic.
    	type:            BodyType,
    	// The initial world position of the body. Bodies should be created with the desired position.
    	// @note Creating bodies at the origin and then moving them nearly doubles the cost of body creation, especially
    	// 	if the body is moved after shapes have been added.
    	position:        [2]f32,
    	// The initial world rotation of the body. Use b2MakeRot() if you have an angle.
    	rotation:        Rot,
    	// The initial linear velocity of the body's origin. Typically in meters per second.
    	linearVelocity:  [2]f32,
    	// The initial angular velocity of the body. Radians per second.
    	angularVelocity: f32,
    	// Linear damping is use to reduce the linear velocity. The damping parameter
    	// can be larger than 1 but the damping effect becomes sensitive to the
    	// time step when the damping parameter is large.
    	// 	Generally linear damping is undesirable because it makes objects move slowly
    	// 	as if they are f32ing.
    	linearDamping:   f32,
    	// Angular damping is use to reduce the angular velocity. The damping parameter
    	// can be larger than 1.0f but the damping effect becomes sensitive to the
    	// time step when the damping parameter is large.
    	// 	Angular damping can be use slow down rotating bodies.
    	angularDamping:  f32,
    	// Scale the gravity applied to this body. Non-dimensional.
    	gravityScale:    f32,
    	// Sleep velocity threshold, default is 0.05 meter per second
    	sleepThreshold:  f32,
    	// Use this to store application specific body data.
    	userData:        rawptr,
    	// Set this flag to false if this body should never fall asleep.
    	enableSleep:     bool,
    	// Is this body initially awake or sleeping?
    	isAwake:         bool,
    	// Should this body be prevented from rotating? Useful for characters.
    	fixedRotation:   bool,
    	// Treat this body as high speed object that performs continuous collision detection
    	// against dynamic and kinematic bodies, but not other bullet bodies.
    	// 	@warning Bullets should be used sparingly. They are not a solution for general dynamic-versus-dynamic
    	// 	continuous collision. They may interfere with joint constraints.
    	isBullet:        bool,
    	// Used to disable a body. A disabled body does not move or collide.
    	isEnabled:       bool,
    	// Automatically compute mass and related properties on this body from shapes.
    	// Triggers whenever a shape is add/removed/changed. Default is true.
    	automaticMass:   bool,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:   i32,
    }
     

    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

    Related Procedures With Parameters
    Related Procedures With Returns

    BodyEvents ¶

    BodyEvents :: struct {
    	// Array of move events
    	moveEvents: [^]BodyMoveEvent `fmt:"v,moveCount"`,
    	// Number of move events
    	moveCount:  i32,
    }
     

    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
    
    Related Procedures With Returns

    BodyId ¶

    BodyId :: struct {
    	index1:   i32,
    	world0:   u16,
    	revision: u16,
    }
     

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

    Related Procedures With Parameters
    Related Procedures With Returns
    Related Constants

    BodyMoveEvent ¶

    BodyMoveEvent :: struct {
    	transform:  Transform,
    	bodyId:     BodyId,
    	userData:   rawptr,
    	fellAsleep: bool,
    }
     

    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 ¶

    BodyType :: enum i32 {
    	// zero mass, zero velocity, may be manually moved
    	staticBody    = 0, 
    	// zero mass, velocity set by user, moved by solver
    	kinematicBody = 1, 
    	// positive mass, velocity determined by forces, moved by solver
    	dynamicBody   = 2, 
    }
     

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

    Related Procedures With Parameters
    Related Procedures With Returns

    Capsule ¶

    Capsule :: struct {
    	// Local center of the first semicircle
    	center1: [2]f32,
    	// Local center of the second semicircle
    	center2: [2]f32,
    	// The radius of the semicircles
    	radius:  f32,
    }
     

    A solid capsule can be viewed as two semicircles connected

    by a rectangle.
    
    Related Procedures With Parameters
    Related Procedures With Returns

    CastOutput ¶

    CastOutput :: struct {
    	// The surface normal at the hit point
    	normal:     [2]f32,
    	// The surface hit point
    	point:      [2]f32,
    	// The fraction of the input translation at collision
    	fraction:   f32,
    	// The number of iterations used
    	iterations: i32,
    	// Did the cast hit?
    	hit:        bool,
    }
     

    Low level ray-cast or shape-cast output data

    Related Procedures With Returns

    CastResultFcn ¶

    CastResultFcn :: proc "c" (shapeId: ShapeId, point: [2]f32, normal: [2]f32, fraction: f32, ctx: rawptr) -> f32
     

    Prototype callback for ray 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 @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 @param fraction the fraction along the ray at the point of intersection

    @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
    
    Related Procedures With Parameters

    ChainDef ¶

    ChainDef :: struct {
    	// Use this to store application specific shape data.
    	userData:      rawptr,
    	// An array of at least 4 points. These are cloned and may be temporary.
    	points:        [^][2]f32 `fmt:"v,count"`,
    	// The point count, must be 4 or more.
    	count:         i32,
    	// The friction coefficient, usually in the range [0,1].
    	friction:      f32,
    	// The restitution (elasticity) usually in the range [0,1].
    	restitution:   f32,
    	// Contact filtering data.
    	filter:        Filter,
    	// Indicates a closed chain formed by connecting the first and last points
    	isLoop:        bool,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue: i32,
    }
     

    Used to create a chain of edges. 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
    - 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_linearSlop
    - 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 smooth edges 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

    Related Procedures With Parameters
    Related Procedures With Returns

    ChainId ¶

    ChainId :: struct {
    	index1:   i32,
    	world0:   u16,
    	revision: u16,
    }
     

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

    Related Procedures With Parameters
    Related Procedures With Returns
    Related Constants

    ContactBeginTouchEvent ¶

    ContactBeginTouchEvent :: struct {
    	// Id of the first shape
    	shapeIdA: ShapeId,
    	// Id of the second shape
    	shapeIdB: ShapeId,
    }
     

    A begin touch event is generated when two shapes begin touching.

    ContactData ¶

    ContactData :: struct {
    	shapeIdA: ShapeId,
    	shapeIdB: ShapeId,
    	manifold: Manifold,
    }
     

    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 ¶

    ContactEndTouchEvent :: struct {
    	// Id of the first shape
    	shapeIdA: ShapeId,
    	// Id of the second shape
    	shapeIdB: ShapeId,
    }
     

    An end touch event is generated when two shapes stop touching.

    ContactEvents ¶

    ContactEvents :: struct {
    	// Array of begin touch events
    	beginEvents: [^]ContactBeginTouchEvent `fmt:"v,beginCount"`,
    	// Array of end touch events
    	endEvents:   [^]ContactEndTouchEvent `fmt:"v,endCount"`,
    	// Array of hit events
    	hitEvents:   [^]ContactHitEvent `fmt:"v,hitCount"`,
    	// Number of begin touch events
    	beginCount:  i32,
    	// Number of end touch events
    	endCount:    i32,
    	// Number of hit events
    	hitCount:    i32,
    }
     

    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
    
    Related Procedures With Returns

    ContactHitEvent ¶

    ContactHitEvent :: struct {
    	// Id of the first shape
    	shapeIdA:      ShapeId,
    	// Id of the second shape
    	shapeIdB:      ShapeId,
    	// Point where the shapes hit
    	point:         [2]f32,
    	// Normal vector pointing from shape A to shape B
    	normal:        [2]f32,
    	// The speed the shapes are approaching. Always positive. Typically in meters per second.
    	approachSpeed: f32,
    }
     

    A hit touch event is generated when two shapes collide with a speed faster than the hit speed threshold.

    Counters ¶

    Counters :: struct {
    	staticBodyCount:  i32,
    	bodyCount:        i32,
    	shapeCount:       i32,
    	contactCount:     i32,
    	jointCount:       i32,
    	islandCount:      i32,
    	stackUsed:        i32,
    	staticTreeHeight: i32,
    	treeHeight:       i32,
    	byteCount:        i32,
    	taskCount:        i32,
    	colorCounts:      [12]i32,
    }
     

    Counters that give details of the simulation size.

    Related Procedures With Returns

    CustomFilterFcn ¶

    CustomFilterFcn :: proc "c" (shapeIdA, shapeIdB: ShapeId, ctx: rawptr) -> bool
     

    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
    
    Related Procedures With Parameters

    DebugDraw ¶

    DebugDraw :: struct {
    	// Draw a closed polygon provided in CCW order.
    	DrawPolygon:          proc "c" (vertices: [^][2]f32, vertexCount: i32, color: HexColor, ctx: rawptr),
    	// Draw a solid closed polygon provided in CCW order.
    	DrawSolidPolygon:     proc "c" (transform: Transform, vertices: [^][2]f32, vertexCount: i32, radius: f32, colr: HexColor, ctx: rawptr),
    	// Draw a circle.
    	DrawCircle:           proc "c" (center: [2]f32, radius: f32, color: HexColor, ctx: rawptr),
    	// Draw a solid circle.
    	DrawSolidCircle:      proc "c" (transform: Transform, radius: f32, color: HexColor, ctx: rawptr),
    	// Draw a capsule.
    	DrawCapsule:          proc "c" (p1, p2: [2]f32, radius: f32, color: HexColor, ctx: rawptr),
    	// Draw a solid capsule.
    	DrawSolidCapsule:     proc "c" (p1, p2: [2]f32, radius: f32, color: HexColor, ctx: rawptr),
    	// Draw a line segment.
    	DrawSegment:          proc "c" (p1, p2: [2]f32, color: HexColor, ctx: rawptr),
    	// Draw a transform. Choose your own length scale.
    	DrawTransform:        proc "c" (transform: Transform, ctx: rawptr),
    	// Draw a point.
    	DrawPoint:            proc "c" (p: [2]f32, size: f32, color: HexColor, ctx: rawptr),
    	// Draw a string.
    	DrawString:           proc "c" (p: [2]f32, s: cstring, ctx: rawptr),
    	// Bounds to use if restricting drawing to a rectangular region
    	drawingBounds:        AABB,
    	// Option to restrict drawing to a rectangular region. May suffer from unstable depth sorting.
    	useDrawingBounds:     bool,
    	// Option to draw shapes
    	drawShapes:           bool,
    	// Option to draw joints
    	drawJoints:           bool,
    	// Option to draw additional information for joints
    	drawJointExtras:      bool,
    	// Option to draw the bounding boxes for shapes
    	drawAABBs:            bool,
    	// Option to draw the mass and center of mass of dynamic bodies
    	drawMass:             bool,
    	// Option to draw contact points
    	drawContacts:         bool,
    	// Option to visualize the graph coloring used for contacts and joints
    	drawGraphColors:      bool,
    	// Option to draw contact normals
    	drawContactNormals:   bool,
    	// Option to draw contact normal impulses
    	drawContactImpulses:  bool,
    	// Option to draw contact friction impulses
    	drawFrictionImpulses: bool,
    	// User context that is passed as an argument to drawing callback functions
    	userContext:          rawptr,
    }
     

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

    @ingroup world
    
    Related Procedures With Parameters

    DistanceCache ¶

    DistanceCache :: struct {
    	// The number of stored simplex points
    	count:  u16,
    	// The cached simplex indices on shape A
    	indexA: [3]u8 `fmt:"v,count"`,
    	// The cached simplex indices on shape B
    	indexB: [3]u8 `fmt:"v,count"`,
    }
     

    Used to warm start b2Distance. Set count to zero on first call or

    use zero initialization.
    
    Related Procedures With Parameters
    Related Constants

    DistanceInput ¶

    DistanceInput :: struct {
    	// The proxy for shape A
    	proxyA:     DistanceProxy,
    	// The proxy for shape B
    	proxyB:     DistanceProxy,
    	// The world transform for shape A
    	transformA: Transform,
    	// The world transform for shape B
    	transformB: Transform,
    	// Should the proxy radius be considered?
    	useRadii:   bool,
    }
     

    Input for b2ShapeDistance

    Related Procedures With Parameters

    DistanceJointDef ¶

    DistanceJointDef :: struct {
    	// The first attached body
    	bodyIdA:          BodyId,
    	// The second attached body
    	bodyIdB:          BodyId,
    	// The local anchor point relative to bodyA's origin
    	localAnchorA:     [2]f32,
    	// The local anchor point relative to bodyB's origin
    	localAnchorB:     [2]f32,
    	// The rest length of this joint. Clamped to a stable minimum value.
    	length:           f32,
    	// Enable the distance constraint to behave like a spring. If false
    	// 	then the distance joint will be rigid, overriding the limit and motor.
    	enableSpring:     bool,
    	// The spring linear stiffness Hertz, cycles per second
    	hertz:            f32,
    	// The spring linear damping ratio, non-dimensional
    	dampingRatio:     f32,
    	// Enable/disable the joint limit
    	enableLimit:      bool,
    	// Minimum length. Clamped to a stable minimum value.
    	minLength:        f32,
    	// Maximum length. Must be greater than or equal to the minimum length.
    	maxLength:        f32,
    	// Enable/disable the joint motor
    	enableMotor:      bool,
    	// The maximum motor force, usually in newtons
    	maxMotorForce:    f32,
    	// The desired motor speed, usually in meters per second
    	motorSpeed:       f32,
    	// Set this flag to true if the attached bodies should collide
    	collideConnected: bool,
    	// User data pointer
    	userData:         rawptr,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:    i32,
    }
     

    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

    Related Procedures With Parameters
    Related Procedures With Returns

    DistanceOutput ¶

    DistanceOutput :: struct {
    	pointA:       [2]f32,
    	// Closest point on shapeA
    	pointB:       [2]f32,
    	// Closest point on shapeB
    	distance:     f32,
    	// The final distance, zero if overlapped
    	iterations:   i32,
    	// Number of GJK iterations used
    	simplexCount: i32,
    }
     

    Output for b2ShapeDistance

    Related Procedures With Returns

    DistanceProxy ¶

    DistanceProxy :: struct {
    	// The point cloud
    	points: [8][2]f32 `fmt:"v,count"`,
    	// The number of points
    	count:  i32,
    	// The external radius of the point cloud
    	radius: f32,
    }
     

    A distance proxy is used by the GJK algorithm. It encapsulates any shape.

    Related Procedures With Returns

    DynamicTree ¶

    DynamicTree :: struct {
    	// The tree nodes
    	nodes:           [^]TreeNode `fmt"v,nodeCount"`,
    	// The root index
    	root:            i32,
    	// The number of nodes
    	nodeCount:       i32,
    	// The allocated node space
    	nodeCapacity:    i32,
    	// Node free list
    	freeList:        i32,
    	// Number of proxies created
    	proxyCount:      i32,
    	// Leaf indices for rebuild
    	leafIndices:     [^]i32,
    	// Leaf bounding boxes for rebuild
    	leafBoxes:       [^]AABB,
    	// Leaf bounding box centers for rebuild
    	leafCenters:     [^][2]f32,
    	// Bins for sorting during rebuild
    	binIndices:      [^]i32,
    	// Allocated space for rebuilding
    	rebuildCapacity: i32,
    }
     

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

    Related Procedures With Parameters
    Related Procedures With Returns

    EnqueueTaskCallback ¶

    EnqueueTaskCallback :: proc "c" (task: TaskCallback, itemCount: i32, minRange: i32, taskContext: rawptr, userContext: rawptr) -> rawptr
     

    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
    

    Filter ¶

    Filter :: struct {
    	// The collision category bits. Normally you would just set one bit. The category bits should
    	// 	represent your application object types. For example:
    	// 	@code{.odin}
    	// 	My_Categories :: enum u32 {
    	// 		Static  = 0x00000001,
    	// 		Dynamic = 0x00000002,
    	// 		Debris  = 0x00000004,
    	// 		Player  = 0x00000008,
    	// 		// etc
    	// 	};
    	// 	@endcode
    	//      Or use a bit_set.
    	categoryBits: u32,
    	// The collision mask bits. This states the categories that this
    	// shape would accept for collision.
    	// 	For example, you may want your player to only collide with static objects
    	// 	and other players.
    	// 	@code{.odin}
    	// 	maskBits = u32(My_Categories.Static | My_Categories.Player);
    	// 	@endcode
    	maskBits:     u32,
    	// Collision groups allow a certain group of objects to never collide (negative)
    	// or always collide (positive). A group index of zero has no effect. Non-zero group filtering
    	// always wins against the mask bits.
    	// 	For example, you may want ragdolls to collide with other ragdolls but you don't want
    	// 	ragdoll self-collision. In this case you would give each ragdoll a unique negative group index
    	// 	and apply that group index to all shapes on the ragdoll.
    	groupIndex:   i32,
    }
     

    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

    Related Procedures With Parameters
    Related Procedures With Returns

    FinishTaskCallback ¶

    FinishTaskCallback :: proc "c" (userTask: rawptr, userContext: rawptr)
     

    Finishes a user task object that wraps a Box2D task.

    @ingroup world
    

    FreeFcn ¶

    FreeFcn :: proc "c" (mem: rawptr)
     

    Prototype for user free function

    @param mem the memory previously allocated through `b2AllocFcn`
    
    Related Procedures With Parameters

    HexColor ¶

    HexColor :: enum i32 {
    	AliceBlue            = 15792383, 
    	AntiqueWhite         = 16444375, 
    	Aqua                 = 65535, 
    	Aquamarine           = 8388564, 
    	Azure                = 15794175, 
    	Beige                = 16119260, 
    	Bisque               = 16770244, 
    	Black                = 0, 
    	BlanchedAlmond       = 16772045, 
    	Blue                 = 255, 
    	BlueViolet           = 9055202, 
    	Brown                = 10824234, 
    	Burlywood            = 14596231, 
    	CadetBlue            = 6266528, 
    	Chartreuse           = 8388352, 
    	Chocolate            = 13789470, 
    	Coral                = 16744272, 
    	CornflowerBlue       = 6591981, 
    	Cornsilk             = 16775388, 
    	Crimson              = 14423100, 
    	Cyan                 = 65535, 
    	DarkBlue             = 139, 
    	DarkCyan             = 35723, 
    	DarkGoldenrod        = 12092939, 
    	DarkGray             = 11119017, 
    	DarkGreen            = 25600, 
    	DarkKhaki            = 12433259, 
    	DarkMagenta          = 9109643, 
    	DarkOliveGreen       = 5597999, 
    	DarkOrange           = 16747520, 
    	DarkOrchid           = 10040012, 
    	DarkRed              = 9109504, 
    	DarkSalmon           = 15308410, 
    	DarkSeaGreen         = 9419919, 
    	DarkSlateBlue        = 4734347, 
    	DarkSlateGray        = 3100495, 
    	DarkTurquoise        = 52945, 
    	DarkViolet           = 9699539, 
    	DeepPink             = 16716947, 
    	DeepSkyBlue          = 49151, 
    	DimGray              = 6908265, 
    	DodgerBlue           = 2003199, 
    	Firebrick            = 11674146, 
    	FloralWhite          = 16775920, 
    	ForestGreen          = 2263842, 
    	Fuchsia              = 16711935, 
    	Gainsboro            = 14474460, 
    	GhostWhite           = 16316671, 
    	Gold                 = 16766720, 
    	Goldenrod            = 14329120, 
    	Gray                 = 12500670, 
    	Gray1                = 1710618, 
    	Gray2                = 3355443, 
    	Gray3                = 5066061, 
    	Gray4                = 6710886, 
    	Gray5                = 8355711, 
    	Gray6                = 10066329, 
    	Gray7                = 11776947, 
    	Gray8                = 13421772, 
    	Gray9                = 15066597, 
    	Green                = 65280, 
    	GreenYellow          = 11403055, 
    	Honeydew             = 15794160, 
    	HotPink              = 16738740, 
    	IndianRed            = 13458524, 
    	Indigo               = 4915330, 
    	Ivory                = 16777200, 
    	Khaki                = 15787660, 
    	Lavender             = 15132410, 
    	LavenderBlush        = 16773365, 
    	LawnGreen            = 8190976, 
    	LemonChiffon         = 16775885, 
    	LightBlue            = 11393254, 
    	LightCoral           = 15761536, 
    	LightCyan            = 14745599, 
    	LightGoldenrod       = 15654274, 
    	LightGoldenrodYellow = 16448210, 
    	LightGray            = 13882323, 
    	LightGreen           = 9498256, 
    	LightPink            = 16758465, 
    	LightSalmon          = 16752762, 
    	LightSeaGreen        = 2142890, 
    	LightSkyBlue         = 8900346, 
    	LightSlateBlue       = 8679679, 
    	LightSlateGray       = 7833753, 
    	LightSteelBlue       = 11584734, 
    	LightYellow          = 16777184, 
    	Lime                 = 65280, 
    	LimeGreen            = 3329330, 
    	Linen                = 16445670, 
    	Magenta              = 16711935, 
    	Maroon               = 11546720, 
    	MediumAquamarine     = 6737322, 
    	MediumBlue           = 205, 
    	MediumOrchid         = 12211667, 
    	MediumPurple         = 9662683, 
    	MediumSeaGreen       = 3978097, 
    	MediumSlateBlue      = 8087790, 
    	MediumSpringGreen    = 64154, 
    	MediumTurquoise      = 4772300, 
    	MediumVioletRed      = 13047173, 
    	MidnightBlue         = 1644912, 
    	MintCream            = 16121850, 
    	MistyRose            = 16770273, 
    	Moccasin             = 16770229, 
    	NavajoWhite          = 16768685, 
    	Navy                 = 128, 
    	NavyBlue             = 128, 
    	OldLace              = 16643558, 
    	Olive                = 8421376, 
    	OliveDrab            = 7048739, 
    	Orange               = 16753920, 
    	OrangeRed            = 16729344, 
    	Orchid               = 14315734, 
    	PaleGoldenrod        = 15657130, 
    	PaleGreen            = 10025880, 
    	PaleTurquoise        = 11529966, 
    	PaleVioletRed        = 14381203, 
    	PapayaWhip           = 16773077, 
    	PeachPuff            = 16767673, 
    	Peru                 = 13468991, 
    	Pink                 = 16761035, 
    	Plum                 = 14524637, 
    	PowderBlue           = 11591910, 
    	Purple               = 10494192, 
    	RebeccaPurple        = 6697881, 
    	Red                  = 16711680, 
    	RosyBrown            = 12357519, 
    	RoyalBlue            = 4286945, 
    	SaddleBrown          = 9127187, 
    	Salmon               = 16416882, 
    	SandyBrown           = 16032864, 
    	SeaGreen             = 3050327, 
    	Seashell             = 16774638, 
    	Sienna               = 10506797, 
    	Silver               = 12632256, 
    	SkyBlue              = 8900331, 
    	SlateBlue            = 6970061, 
    	SlateGray            = 7372944, 
    	Snow                 = 16775930, 
    	SpringGreen          = 65407, 
    	SteelBlue            = 4620980, 
    	Tan                  = 13808780, 
    	Teal                 = 32896, 
    	Thistle              = 14204888, 
    	Tomato               = 16737095, 
    	Turquoise            = 4251856, 
    	Violet               = 15631086, 
    	VioletRed            = 13639824, 
    	Wheat                = 16113331, 
    	White                = 16777215, 
    	WhiteSmoke           = 16119285, 
    	Yellow               = 16776960, 
    	YellowGreen          = 10145074, 
    	Box2DRed             = 14430514, 
    	Box2DBlue            = 3190463, 
    	Box2DGreen           = 9226532, 
    	Box2DYellow          = 16772748, 
    }
     

    These colors are used for debug draw.

    See https://www.rapidtables.com/web/color/index.html
    

    Hull ¶

    Hull :: struct {
    	// The final points of the hull
    	points: [8][2]f32 `fmt:"v,count"`,
    	// The number of points
    	count:  i32,
    }
     

    A convex hull. Used to create convex polygons.

    @warning Do not modify these values directly, instead use b2ComputeHull()
    
    Related Procedures With Parameters
    Related Procedures With Returns

    JointId ¶

    JointId :: struct {
    	index1:   i32,
    	world0:   u16,
    	revision: u16,
    }
     

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

    Related Procedures With Parameters
    Related Procedures With Returns
    Related Constants

    JointType ¶

    JointType :: enum i32 {
    	distanceJoint, 
    	motorJoint, 
    	mouseJoint, 
    	prismaticJoint, 
    	revoluteJoint, 
    	weldJoint, 
    	wheelJoint, 
    }
     

    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

    Related Procedures With Returns

    Manifold ¶

    Manifold :: struct {
    	// The manifold points, up to two are possible in 2D
    	points:     [2]ManifoldPoint,
    	// The unit normal vector in world space, points from shape A to bodyB
    	normal:     [2]f32,
    	// The number of contacts points, will be 0, 1, or 2
    	pointCount: i32,
    }
     

    A contact manifold describes the contact points between colliding shapes

    Related Procedures With Returns

    ManifoldPoint ¶

    ManifoldPoint :: struct {
    	// Location of the contact point in world space. Subject to precision loss at large coordinates.
    	// 	@note Should only be used for debugging.
    	point:            [2]f32,
    	// Location of the contact point relative to bodyA's origin in world space
    	// 	@note When used internally to the Box2D solver, these are relative to the center of mass.
    	anchorA:          [2]f32,
    	// Location of the contact point relative to bodyB's origin in world space
    	anchorB:          [2]f32,
    	// The separation of the contact point, negative if penetrating
    	separation:       f32,
    	// The impulse along the manifold normal vector.
    	normalImpulse:    f32,
    	// The friction impulse
    	tangentImpulse:   f32,
    	// The maximum normal impulse applied during sub-stepping
    	// 	todo not sure this is needed
    	maxNormalImpulse: f32,
    	// Relative normal velocity pre-solve. Used for hit events. If the normal impulse is
    	// zero then there was no hit. Negative means shapes are approaching.
    	normalVelocity:   f32,
    	// Uniquely identifies a contact point between two shapes
    	id:               u16,
    	// Did this contact point exist the previous step?
    	persisted:        bool,
    }
     

    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.

    MassData ¶

    MassData :: struct {
    	// The mass of the shape, usually in kilograms.
    	mass:              f32,
    	// The position of the shape's centroid relative to the shape's origin.
    	center:            [2]f32,
    	// The rotational inertia of the shape about the local origin.
    	rotationalInertia: f32,
    }
     

    This holds the mass data computed for a shape.

    Related Procedures With Parameters
    Related Procedures With Returns

    Mat22 ¶

    Mat22 :: matrix[2, 2]f32
    Related Constants

    MotorJointDef ¶

    MotorJointDef :: struct {
    	// The first attached body
    	bodyIdA:          BodyId,
    	// The second attached body
    	bodyIdB:          BodyId,
    	// Position of bodyB minus the position of bodyA, in bodyA's frame
    	linearOffset:     [2]f32,
    	// The bodyB angle minus bodyA angle in radians
    	angularOffset:    f32,
    	// The maximum motor force in newtons
    	maxForce:         f32,
    	// The maximum motor torque in newton-meters
    	maxTorque:        f32,
    	// Position correction factor in the range [0,1]
    	correctionFactor: f32,
    	// Set this flag to true if the attached bodies should collide
    	collideConnected: bool,
    	// User data pointer
    	userData:         rawptr,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:    i32,
    }
     

    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

    Related Procedures With Parameters
    Related Procedures With Returns

    MouseJointDef ¶

    MouseJointDef :: struct {
    	// The first attached body.
    	bodyIdA:          BodyId,
    	// The second attached body.
    	bodyIdB:          BodyId,
    	// The initial target point in world space
    	target:           [2]f32,
    	// Stiffness in hertz
    	hertz:            f32,
    	// Damping ratio, non-dimensional
    	dampingRatio:     f32,
    	// Maximum force, typically in newtons
    	maxForce:         f32,
    	// Set this flag to true if the attached bodies should collide.
    	collideConnected: bool,
    	// User data pointer
    	userData:         rawptr,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:    i32,
    }
     

    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

    Related Procedures With Parameters
    Related Procedures With Returns

    OverlapResultFcn ¶

    OverlapResultFcn :: proc "c" (shapeId: ShapeId, ctx: rawptr) -> bool
     

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

    @ingroup world
    
    Related Procedures With Parameters

    Polygon ¶

    Polygon :: struct {
    	// The polygon vertices
    	vertices: [8][2]f32 `fmt:"v,count"`,
    	// The outward normal vectors of the polygon sides
    	normals:  [8][2]f32 `fmt:"v,count"`,
    	// The centroid of the polygon
    	centroid: [2]f32,
    	// The external radius for rounded polygons
    	radius:   f32,
    	// The number of polygon vertices
    	count:    i32,
    }
     

    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 maxPolygonVertices. 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.
    
    Related Procedures With Parameters
    Related Procedures With Returns

    PreSolveFcn ¶

    PreSolveFcn :: proc "c" (shapeIdA, shapeIdB: ShapeId, manifold: ^Manifold, ctx: rawptr) -> bool
     

    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
    
    Related Procedures With Parameters

    PrismaticJointDef ¶

    PrismaticJointDef :: struct {
    	// The first attached body
    	bodyIdA:          BodyId,
    	// The second attached body
    	bodyIdB:          BodyId,
    	// The local anchor point relative to bodyA's origin
    	localAnchorA:     [2]f32,
    	// The local anchor point relative to bodyB's origin
    	localAnchorB:     [2]f32,
    	// The local translation unit axis in bodyA
    	localAxisA:       [2]f32,
    	// The constrained angle between the bodies: bodyB_angle - bodyA_angle
    	referenceAngle:   f32,
    	// Enable a linear spring along the prismatic joint axis
    	enableSpring:     bool,
    	// The spring stiffness Hertz, cycles per second
    	hertz:            f32,
    	// The spring damping ratio, non-dimensional
    	dampingRatio:     f32,
    	// Enable/disable the joint limit
    	enableLimit:      bool,
    	// The lower translation limit
    	lowerTranslation: f32,
    	// The upper translation limit
    	upperTranslation: f32,
    	// Enable/disable the joint motor
    	enableMotor:      bool,
    	// The maximum motor force, typically in newtons
    	maxMotorForce:    f32,
    	// The desired motor speed, typically in meters per second
    	motorSpeed:       f32,
    	// Set this flag to true if the attached bodies should collide
    	collideConnected: bool,
    	// User data pointer
    	userData:         rawptr,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:    i32,
    }
     

    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

    Related Procedures With Parameters
    Related Procedures With Returns

    Profile ¶

    Profile :: struct {
    	step:                f32,
    	pairs:               f32,
    	collide:             f32,
    	solve:               f32,
    	buildIslands:        f32,
    	solveConstraints:    f32,
    	prepareTasks:        f32,
    	solverTasks:         f32,
    	prepareConstraints:  f32,
    	integrateVelocities: f32,
    	warmStart:           f32,
    	solveVelocities:     f32,
    	integratePositions:  f32,
    	relaxVelocities:     f32,
    	applyRestitution:    f32,
    	storeImpulses:       f32,
    	finalizeBodies:      f32,
    	splitIslands:        f32,
    	sleepIslands:        f32,
    	hitEvents:           f32,
    	broadphase:          f32,
    	continuous:          f32,
    }
     

    ! @cond Profiling data. Times are in milliseconds.

    Related Procedures With Returns

    QueryFilter ¶

    QueryFilter :: struct {
    	// The collision category bits of this query. Normally you would just set one bit.
    	categoryBits: u32,
    	// The collision mask bits. This states the shape categories that this
    	// query would accept for collision.
    	maskBits:     u32,
    }
     

    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

    Related Procedures With Parameters
    Related Procedures With Returns

    RayCastInput ¶

    RayCastInput :: struct {
    	// Start point of the ray cast
    	origin:      [2]f32,
    	// Translation of the ray cast
    	translation: [2]f32,
    	// The maximum fraction of the translation to consider, typically 1
    	maxFraction: f32,
    }
     

    Low level ray-cast input data

    Related Procedures With Parameters

    RayResult ¶

    RayResult :: struct {
    	shapeId:  ShapeId,
    	point:    [2]f32,
    	normal:   [2]f32,
    	fraction: f32,
    	hit:      bool,
    }
     

    Result from b2World_RayCastClosest @ingroup world

    Related Procedures With Returns

    RevoluteJointDef ¶

    RevoluteJointDef :: struct {
    	// The first attached body
    	bodyIdA:          BodyId,
    	// The second attached body
    	bodyIdB:          BodyId,
    	// The local anchor point relative to bodyA's origin
    	localAnchorA:     [2]f32,
    	// The local anchor point relative to bodyB's origin
    	localAnchorB:     [2]f32,
    	// The bodyB angle minus bodyA angle in the reference state (radians).
    	// This defines the zero angle for the joint limit.
    	referenceAngle:   f32,
    	// Enable a rotational spring on the revolute hinge axis
    	enableSpring:     bool,
    	// The spring stiffness Hertz, cycles per second
    	hertz:            f32,
    	// The spring damping ratio, non-dimensional
    	dampingRatio:     f32,
    	// A flag to enable joint limits
    	enableLimit:      bool,
    	// The lower angle for the joint limit in radians
    	lowerAngle:       f32,
    	// The upper angle for the joint limit in radians
    	upperAngle:       f32,
    	// A flag to enable the joint motor
    	enableMotor:      bool,
    	// The maximum motor torque, typically in newton-meters
    	maxMotorTorque:   f32,
    	// The desired motor speed in radians per second
    	motorSpeed:       f32,
    	// Scale the debug draw
    	drawSize:         f32,
    	// Set this flag to true if the attached bodies should collide
    	collideConnected: bool,
    	// User data pointer
    	userData:         rawptr,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:    i32,
    }
     

    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

    Related Procedures With Parameters
    Related Procedures With Returns

    Segment ¶

    Segment :: struct {
    	// The first point
    	point1: [2]f32,
    	// The second point
    	point2: [2]f32,
    }
     

    A line segment with two-sided collision.

    Related Procedures With Parameters
    Related Procedures With Returns

    SegmentDistanceResult ¶

    SegmentDistanceResult :: struct {
    	// The closest point on the first segment
    	closest1:        [2]f32,
    	// The closest point on the second segment
    	closest2:        [2]f32,
    	// The barycentric coordinate on the first segment
    	fraction1:       f32,
    	// The barycentric coordinate on the second segment
    	fraction2:       f32,
    	// The squared distance between the closest points
    	distanceSquared: f32,
    }
     

    Result of computing the distance between two line segments

    Related Procedures With Returns

    SensorBeginTouchEvent ¶

    SensorBeginTouchEvent :: struct {
    	// The id of the sensor shape
    	sensorShapeId:  ShapeId,
    	// The id of the dynamic shape that began touching the sensor shape
    	visitorShapeId: ShapeId,
    }
     

    A begin touch event is generated when a shape starts to overlap a sensor shape.

    SensorEndTouchEvent ¶

    SensorEndTouchEvent :: struct {
    	// The id of the sensor shape
    	sensorShapeId:  ShapeId,
    	// The id of the dynamic shape that began touching the sensor shape
    	visitorShapeId: ShapeId,
    }
     

    An end touch event is generated when a shape stops overlapping a sensor shape.

    SensorEvents ¶

    SensorEvents :: struct {
    	// Array of sensor begin touch events
    	beginEvents: [^]SensorBeginTouchEvent `fmt:"v,beginCount"`,
    	// Array of sensor end touch events
    	endEvents:   [^]SensorEndTouchEvent `fmt:"v,endCount"`,
    	// The number of begin touch events
    	beginCount:  i32,
    	// The number of end touch events
    	endCount:    i32,
    }
     

    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
    
    Related Procedures With Returns

    ShapeCastInput ¶

    ShapeCastInput :: struct {
    	// A point cloud to cast
    	points:      [8][2]f32 `fmt:"v,count"`,
    	// The number of points
    	count:       i32,
    	// The radius around the point cloud
    	radius:      f32,
    	// The translation of the shape cast
    	translation: [2]f32,
    	// The maximum fraction of the translation to consider, typically 1
    	maxFraction: f32,
    }
     

    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.
    
    Related Procedures With Parameters

    ShapeCastPairInput ¶

    ShapeCastPairInput :: struct {
    	proxyA:       DistanceProxy,
    	// The proxy for shape A
    	proxyB:       DistanceProxy,
    	// The proxy for shape B
    	transformA:   Transform,
    	// The world transform for shape A
    	transformB:   Transform,
    	// The world transform for shape B
    	translationB: [2]f32,
    	// The translation of shape B
    	maxFraction:  f32,
    }
     

    Input parameters for b2ShapeCast

    Related Procedures With Parameters

    ShapeDef ¶

    ShapeDef :: struct {
    	// Use this to store application specific shape data.
    	userData:             rawptr,
    	// The Coulomb (dry) friction coefficient, usually in the range [0,1].
    	friction:             f32,
    	// The restitution (bounce) usually in the range [0,1].
    	restitution:          f32,
    	// The density, usually in kg/m^2.
    	density:              f32,
    	// Collision filtering data.
    	filter:               Filter,
    	// Custom debug draw color.
    	customColor:          u32,
    	// A sensor shape generates overlap events but never generates a collision response.
    	isSensor:             bool,
    	// Enable sensor events for this shape. Only applies to kinematic and dynamic bodies. Ignored for sensors.
    	enableSensorEvents:   bool,
    	// Enable contact events for this shape. Only applies to kinematic and dynamic bodies. Ignored for sensors.
    	enableContactEvents:  bool,
    	// Enable hit events for this shape. Only applies to kinematic and dynamic bodies. Ignored for sensors.
    	enableHitEvents:      bool,
    	// Enable pre-solve contact events for this shape. Only applies to dynamic bodies. These are expensive
    	// 	and must be carefully handled due to threading. Ignored for sensors.
    	enablePreSolveEvents: bool,
    	// Normally shapes on static bodies don't invoke contact creation when they are added to the world. This overrides
    	// 	that behavior and causes contact creation. This significantly slows down static body creation which can be important
    	// 	when there are many static shapes.
    	forceContactCreation: bool,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:        i32,
    }
     

    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

    Related Procedures With Parameters
    Related Procedures With Returns

    ShapeType ¶

    ShapeType :: enum i32 {
    	// A circle with an offset
    	circleShape, 
    	// A capsule is an extruded circle
    	capsuleShape, 
    	// A line segment
    	segmentShape, 
    	// A convex polygon
    	polygonShape, 
    	// A smooth segment owned by a chain shape
    	smoothSegmentShape, 
    }
     

    Shape type @ingroup shape

    Related Procedures With Returns

    Simplex ¶

    Simplex :: struct {
    	v1:    SimplexVertex `fmt:"v,count"`,
    	v2:    SimplexVertex `fmt:"v,count"`,
    	v3:    SimplexVertex `fmt:"v,count"`,
    	// vertices
    	count: i32,
    }
     

    Simplex from the GJK algorithm

    SimplexVertex ¶

    SimplexVertex :: struct {
    	wA:     [2]f32,
    	// support point in proxyA
    	wB:     [2]f32,
    	// support point in proxyB
    	w:      [2]f32,
    	// wB - wA
    	a:      f32,
    	// barycentric coordinate for closest point
    	indexA: i32,
    	// wA index
    	indexB: i32,
    }
     

    Simplex vertex for debugging the GJK algorithm

    SmoothSegment ¶

    SmoothSegment :: struct {
    	// The tail ghost vertex
    	ghost1:  [2]f32,
    	// The line segment
    	segment: Segment,
    	// The head ghost vertex
    	ghost2:  [2]f32,
    	// The owning chain shape index (internal usage only)
    	chainId: i32,
    }
     

    A smooth 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

    Related Procedures With Parameters
    Related Procedures With Returns

    Sweep ¶

    Sweep :: struct {
    	localCenter: [2]f32,
    	// Local center of mass position
    	c1:          [2]f32,
    	// Starting center of mass world position
    	c2:          [2]f32,
    	// Ending center of mass world position
    	q1:          Rot,
    	// Starting world rotation
    	q2:          Rot,
    }
     

    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.

    Related Procedures With Parameters

    TOIInput ¶

    TOIInput :: struct {
    	proxyA: DistanceProxy,
    	// The proxy for shape A
    	proxyB: DistanceProxy,
    	// The proxy for shape B
    	sweepA: Sweep,
    	// The movement of shape A
    	sweepB: Sweep,
    	// The movement of shape B
    	tMax:   f32,
    }
     

    Input parameters for b2TimeOfImpact

    Related Procedures With Parameters

    TOIOutput ¶

    TOIOutput :: struct {
    	state: TOIState,
    	// The type of result
    	t:     f32,
    }
     

    Output parameters for b2TimeOfImpact.

    Related Procedures With Returns

    TOIState ¶

    TOIState :: enum i32 {
    	Unknown, 
    	Failed, 
    	Overlapped, 
    	Hit, 
    	Separated, 
    }
     

    Describes the TOI output

    TaskCallback ¶

    TaskCallback :: proc "c" (startIndex, endIndex: i32, workerIndex: u32, taskContext: rawptr)
     

    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
    

    Timer ¶

    Timer :: struct {
    	start: i64,
    }
     

    Timer for profiling. This has platform specific code and may not work on every platform.

    Related Procedures With Parameters
    Related Procedures With Returns

    TreeNode ¶

    TreeNode :: struct {
    	// The node bounding box
    	aabb:         AABB,
    	// Category bits for collision filtering
    	categoryBits: u32,
    	// 4
    	using _:      struct #raw_union {
    		// The node parent index
    		parent: i32,
    		// The node freelist next index
    		next:   i32,
    	},
    	// Child 1 index
    	child1:       i32,
    	// Child 2 index
    	child2:       i32,
    	// User data
    	// todo could be union with child index
    	userData:     i32,
    	// Leaf = 0, free node = -1
    	height:       i16,
    	// Has the AABB been enlarged?
    	enlarged:     bool,
    	// Padding for clarity
    	_:            [9]u8,
    }
     

    A node in the dynamic tree. This is private data placed here for performance reasons. 16 + 16 + 8 + pad(8)

    TreeQueryCallbackFcn ¶

    TreeQueryCallbackFcn :: proc "c" (proxyId: i32, userData: i32, ctx: rawptr) -> bool
     

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

    Related Procedures With Parameters

    TreeRayCastCallbackFcn ¶

    TreeRayCastCallbackFcn :: proc "c" (#by_ptr input: RayCastInput, proxyId: i32, userData: i32, ctx: rawptr) -> f32
     

    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

    Related Procedures With Parameters

    TreeShapeCastCallbackFcn ¶

    TreeShapeCastCallbackFcn :: proc "c" (#by_ptr input: ShapeCastInput, proxyId: i32, userData: i32, ctx: rawptr) -> f32
     

    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

    Related Procedures With Parameters

    Vec2 ¶

    Vec2 :: [2]f32
    Related Constants

    Version ¶

    Version :: struct {
    	major:    i32,
    	// Significant changes
    	minor:    i32,
    	// Incremental changes
    	revision: i32,
    }
     

    Version numbering scheme.

    See https://semver.org/

    WeldJointDef ¶

    WeldJointDef :: struct {
    	// The first attached body
    	bodyIdA:             BodyId,
    	// The second attached body
    	bodyIdB:             BodyId,
    	// The local anchor point relative to bodyA's origin
    	localAnchorA:        [2]f32,
    	// The local anchor point relative to bodyB's origin
    	localAnchorB:        [2]f32,
    	// The bodyB angle minus bodyA angle in the reference state (radians)
    	referenceAngle:      f32,
    	// Linear stiffness expressed as Hertz (cycles per second). Use zero for maximum stiffness.
    	linearHertz:         f32,
    	// Angular stiffness as Hertz (cycles per second). Use zero for maximum stiffness.
    	angularHertz:        f32,
    	// Linear damping ratio, non-dimensional. Use 1 for critical damping.
    	linearDampingRatio:  f32,
    	// Linear damping ratio, non-dimensional. Use 1 for critical damping.
    	angularDampingRatio: f32,
    	// Set this flag to true if the attached bodies should collide
    	collideConnected:    bool,
    	// User data pointer
    	userData:            rawptr,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:       i32,
    }
     

    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

    Related Procedures With Parameters
    Related Procedures With Returns

    WheelJointDef ¶

    WheelJointDef :: struct {
    	// The first attached body
    	bodyIdA:          BodyId,
    	// The second attached body
    	bodyIdB:          BodyId,
    	// The local anchor point relative to bodyA's origin
    	localAnchorA:     [2]f32,
    	// The local anchor point relative to bodyB's origin
    	localAnchorB:     [2]f32,
    	// The local translation unit axis in bodyA
    	localAxisA:       [2]f32,
    	// Enable a linear spring along the local axis
    	enableSpring:     bool,
    	// Spring stiffness in Hertz
    	hertz:            f32,
    	// Spring damping ratio, non-dimensional
    	dampingRatio:     f32,
    	// Enable/disable the joint linear limit
    	enableLimit:      bool,
    	// The lower translation limit
    	lowerTranslation: f32,
    	// The upper translation limit
    	upperTranslation: f32,
    	// Enable/disable the joint rotational motor
    	enableMotor:      bool,
    	// The maximum motor torque, typically in newton-meters
    	maxMotorTorque:   f32,
    	// The desired motor speed in radians per second
    	motorSpeed:       f32,
    	// Set this flag to true if the attached bodies should collide
    	collideConnected: bool,
    	// User data pointer
    	userData:         rawptr,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:    i32,
    }
     

    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

    Related Procedures With Parameters
    Related Procedures With Returns

    WorldDef ¶

    WorldDef :: struct {
    	// Gravity vector. Box2D has no up-vector defined.
    	gravity:                [2]f32,
    	// Restitution velocity threshold, usually in m/s. Collisions above this
    	// speed have restitution applied (will bounce).
    	restitutionThreshold:   f32,
    	// This parameter controls how fast overlap is resolved and has units of meters per second
    	contactPushoutVelocity: f32,
    	// Threshold velocity for hit events. Usually meters per second.
    	hitEventThreshold:      f32,
    	// Contact stiffness. Cycles per second.
    	contactHertz:           f32,
    	// Contact bounciness. Non-dimensional.
    	contactDampingRatio:    f32,
    	// Joint stiffness. Cycles per second.
    	jointHertz:             f32,
    	// Joint bounciness. Non-dimensional.
    	jointDampingRatio:      f32,
    	// Can bodies go to sleep to improve performance
    	enableSleep:            bool,
    	// Enable continuous collision
    	enableContinous:        bool,
    	// Number of workers to use with the provided task system. Box2D performs best when using only
    	// 	performance cores and accessing a single L2 cache. Efficiency cores and hyper-threading provide
    	// 	little benefit and may even harm performance.
    	workerCount:            i32,
    	// Function to spawn tasks
    	enqueueTask:            EnqueueTaskCallback,
    	// Function to finish a task
    	finishTask:             FinishTaskCallback,
    	// User context that is provided to enqueueTask and finishTask
    	userTaskContext:        rawptr,
    	// Used internally to detect a valid definition. DO NOT SET.
    	internalValue:          i32,
    }
     

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

    Related Procedures With Parameters
    Related Procedures With Returns

    Constants

    Mat22_zero ¶

    Mat22_zero: matrix[2, 2]f32 : Mat22{0, 0, 0, 0}

    Rot_identity ¶

    Rot_identity :: Rot{1, 0}

    Transform_identity ¶

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

    Vec2_zero ¶

    Vec2_zero: [2]f32 : Vec2{0, 0}

    bodyTypeCount ¶

    bodyTypeCount :: len(BodyType)
     

    number of body types

    defaultCategoryBits ¶

    defaultCategoryBits :: 0x00000001
     

    The default category bit for a tree proxy. Used for collision filtering.

    defaultMaskBits ¶

    defaultMaskBits :: 0xFFFFFFFF
     

    Convenience mask bits to use when you don't need collision filtering and just want

    all results.
    

    emptyDistanceCache ¶

    emptyDistanceCache :: DistanceCache{}

    maxPolygonVertices ¶

    maxPolygonVertices :: 8
     

    The maximum number of vertices on a convex polygon. Changing this affects performance even if you

    don't use more vertices.
    

    nullBodyId ¶

    nullBodyId :: BodyId{}

    nullChainId ¶

    nullChainId :: ChainId{}

    nullJointId ¶

    nullJointId :: JointId{}

    nullShapeId ¶

    nullShapeId :: ShapeId{}

    nullWorldId ¶

    nullWorldId :: WorldId{}
     

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

    pi ¶

    pi :: 3.14159265359

    shapeTypeCount ¶

    shapeTypeCount :: len(ShapeType)
     

    The number of shape types

    Variables

    This section is empty.

    Procedures

    AABB_Center ¶

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

    Get the center of the AABB.

    AABB_Contains ¶

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

    Does a fully contain b

    AABB_Extents ¶

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

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

    AABB_Union ¶

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

    Union of two AABBs

    Abs ¶

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

    Component-wise absolute vector

    AbsFloat ¶

    AbsFloat :: proc "c" (a: f32) -> f32 {…}
     

    @return the absolute value of a float

    AbsInt ¶

    AbsInt :: proc "c" (a: i32) -> i32 {…}
     

    @return the absolute value of an integer

    Add ¶

    Add :: proc "c" (a, b: [2]f32) -> [2]f32 {…}
     

    Vector addition

    Body_ApplyAngularImpulse ¶

    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, typically in units of kgmm/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 ¶

    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, typically in newtons (N) @param point The world position of the point of application @param wake Option to wake up the body

    Body_ApplyForceToCenter ¶

    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 ¶

    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, typically in Ns or kgm/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 ¶

    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, typically in Ns or kgm/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 ¶

    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 ¶

    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), typically in N*m. @param wake also wake up the body

    Body_ComputeAABB ¶

    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 ¶

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

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

    Body_Enable ¶

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

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

    Body_EnableHitEvents ¶

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

    Enable/disable hit events on all shapes

    @see b2ShapeDef::enableHitEvents
    

    Body_EnableSleep ¶

    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 ¶

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

    Get the current angular damping.

    Body_GetAngularVelocity ¶

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

    Get the angular velocity of a body in radians per second

    Body_GetAutomaticMass ¶

    Body_GetAutomaticMass :: proc "c" (bodyId: BodyId) -> bool ---
     

    Get the automatic mass setting

    Body_GetContactCapacity ¶

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

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

    Body_GetContactData ¶

    Body_GetContactData :: proc "c" (bodyId: BodyId, contactData: []ContactData) -> []ContactData {…}
     

    Get the touching contact data for a body

    Body_GetGravityScale ¶

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

    Get the current gravity scale

    Body_GetInertiaTensor ¶

    Body_GetInertiaTensor :: proc "c" (bodyId: BodyId) -> f32 ---
     

    Get the inertia tensor of the body, typically in kg*m^2

    Body_GetJointCount ¶

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

    Get the number of joints on this body

    Body_GetJoints ¶

    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 ¶

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

    Get the current linear damping.

    Body_GetLinearVelocity ¶

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

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

    Body_GetLocalCenterOfMass ¶

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

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

    Body_GetLocalPoint ¶

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

    Get a local point on a body given a world point

    Body_GetLocalVector ¶

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

    Get a local vector on a body given a world vector

    Body_GetMass ¶

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

    Get the mass of the body, typically in kilograms

    Body_GetMassData ¶

    Body_GetMassData :: proc "c" (bodyId: BodyId) -> MassData ---
     

    Get the mass data for a body

    Body_GetPosition ¶

    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 ¶

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

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

    Body_GetShapeCount ¶

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

    Get the number of shapes on this body

    Body_GetShapes ¶

    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 ¶

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

    Get the sleep threshold, typically in meters per second.

    Body_GetTransform ¶

    Body_GetTransform :: proc "c" (bodyId: BodyId) -> Transform ---
     

    Get the world transform of a body.

    Body_GetType ¶

    Body_GetType :: proc "c" (bodyId: BodyId) -> BodyType ---
     

    Get the body type: static, kinematic, or dynamic

    Body_GetUserData ¶

    Body_GetUserData :: proc "c" (bodyId: BodyId) -> rawptr ---
     

    Get the user data stored in a body

    Body_GetWorldCenterOfMass ¶

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

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

    Body_GetWorldPoint ¶

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

    Get a world point on a body given a local point

    Body_GetWorldVector ¶

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

    Get a world vector on a body given a local vector

    Body_IsAwake ¶

    Body_IsAwake :: proc "c" (bodyId: BodyId) -> bool ---
     

    @return true if this body is awake

    Body_IsBullet ¶

    Body_IsBullet :: proc "c" (bodyId: BodyId) -> bool ---
     

    Is this body a bullet?

    Body_IsEnabled ¶

    Body_IsEnabled :: proc "c" (bodyId: BodyId) -> bool ---
     

    Returns true if this body is enabled

    Body_IsFixedRotation ¶

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

    Does this body have fixed rotation?

    Body_IsSleepEnabled ¶

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

    Returns true if sleeping is enabled for this body

    Body_IsValid ¶

    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 ¶

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

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

    Body_SetAngularVelocity ¶

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

    Set the angular velocity of a body in radians per second

    Body_SetAutomaticMass ¶

    Body_SetAutomaticMass :: proc "c" (bodyId: BodyId, automaticMass: bool) ---
     

    Set the automatic mass setting. Normally this is set in BodyDef before creation.

    @see BodyDef::automaticMass
    

    Body_SetAwake ¶

    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 ¶

    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 ¶

    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 ¶

    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 ¶

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

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

    Body_SetLinearVelocity ¶

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

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

    Body_SetMassData ¶

    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_SetSleepThreshold ¶

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

    Set the sleep threshold, typically in meters per second

    Body_SetTransform ¶

    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 ¶

    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.
    

    Body_SetUserData ¶

    Body_SetUserData :: proc "c" (bodyId: BodyId, userData: rawptr) ---
     

    Set the user data for a body

    Chain_IsValid ¶

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

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

    Chain_SetFriction ¶

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

    Set the chain friction @see b2ChainDef::friction

    Chain_SetRestitution ¶

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

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

    Clamp ¶

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

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

    ClampFloat ¶

    ClampFloat :: proc "c" (a, lower, upper: f32) -> f32 {…}
     

    @return a f32 clamped between a lower and upper bound

    ClampInt ¶

    ClampInt :: proc "c" (a, lower, upper: i32) -> i32 {…}
     

    @return an integer clamped between a lower and upper bound

    CollideCapsuleAndCircle ¶

    CollideCapsuleAndCircle :: proc "c" (#by_ptr capsuleA: Capsule, xfA: Transform, #by_ptr circleB: Circle, xfB: Transform) -> Manifold ---
     

    Compute the contact manifold between a capsule and circle

    CollideCapsules ¶

    CollideCapsules :: proc "c" (#by_ptr capsuleA: Capsule, xfA: Transform, #by_ptr capsuleB: Capsule, xfB: Transform) -> Manifold ---
     

    Compute the contact manifold between a capsule and circle

    CollideCircles ¶

    CollideCircles :: proc "c" (#by_ptr circleA: Circle, xfA: Transform, #by_ptr circleB: Circle, xfB: Transform) -> Manifold ---
     

    Compute the contact manifold between two circles

    CollidePolygonAndCapsule ¶

    CollidePolygonAndCapsule :: proc "c" (#by_ptr polygonA: Polygon, xfA: Transform, #by_ptr capsuleB: Capsule, xfB: Transform) -> Manifold ---
     

    Compute the contact manifold between a polygon and capsule

    CollidePolygonAndCircle ¶

    CollidePolygonAndCircle :: proc "c" (#by_ptr polygonA: Polygon, xfA: Transform, #by_ptr circleB: Circle, xfB: Transform) -> Manifold ---
     

    Compute the contact manifold between a polygon and a circle

    CollidePolygons ¶

    CollidePolygons :: proc "c" (#by_ptr polygonA: Polygon, xfA: Transform, #by_ptr polygonB: Polygon, xfB: Transform) -> Manifold ---
     

    Compute the contact manifold between two polygons

    CollideSegmentAndCapsule ¶

    CollideSegmentAndCapsule :: proc "c" (#by_ptr segmentA: Segment, xfA: Transform, #by_ptr capsuleB: Capsule, xfB: Transform) -> Manifold ---
     

    Compute the contact manifold between an segment and a capsule

    CollideSegmentAndCircle ¶

    CollideSegmentAndCircle :: proc "c" (#by_ptr segmentA: Segment, xfA: Transform, #by_ptr circleB: Circle, xfB: Transform) -> Manifold ---
     

    Compute the contact manifold between an segment and a circle

    CollideSegmentAndPolygon ¶

    CollideSegmentAndPolygon :: proc "c" (#by_ptr segmentA: Segment, xfA: Transform, #by_ptr polygonB: Polygon, xfB: Transform) -> Manifold ---
     

    Compute the contact manifold between an segment and a polygon

    CollideSmoothSegmentAndCapsule ¶

    CollideSmoothSegmentAndCapsule :: proc "c" (#by_ptr smoothSegmentA: SmoothSegment, xfA: Transform, #by_ptr capsuleB: Capsule, xfB: Transform, cache: ^DistanceCache) -> Manifold ---
     

    Compute the contact manifold between an segment and a capsule

    CollideSmoothSegmentAndCircle ¶

    CollideSmoothSegmentAndCircle :: proc "c" (#by_ptr smoothSegmentA: SmoothSegment, xfA: Transform, #by_ptr circleB: Circle, xfB: Transform) -> Manifold ---
     

    Compute the contact manifold between a smooth segment and a circle

    CollideSmoothSegmentAndPolygon ¶

    CollideSmoothSegmentAndPolygon :: proc "c" (#by_ptr smoothSegmentA: SmoothSegment, xfA: Transform, #by_ptr polygonB: Polygon, xfB: Transform, cache: ^DistanceCache) -> Manifold ---
     

    Compute the contact manifold between a smooth segment and a rounded polygon

    ComputeAngularVelocity ¶

    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
    

    ComputeCapsuleAABB ¶

    ComputeCapsuleAABB :: proc "c" (#by_ptr shape: Capsule, transform: Transform) -> AABB ---
     

    Compute the bounding box of a transformed capsule

    ComputeCapsuleMass ¶

    ComputeCapsuleMass :: proc "c" (#by_ptr shape: Capsule, density: f32) -> MassData ---
     

    Compute mass properties of a capsule

    ComputeCircleAABB ¶

    ComputeCircleAABB :: proc "c" (#by_ptr shape: Circle, transform: Transform) -> AABB ---
     

    Compute the bounding box of a transformed circle

    ComputeCircleMass ¶

    ComputeCircleMass :: proc "c" (#by_ptr shape: Circle, density: f32) -> MassData ---
     

    Compute mass properties of a circle

    ComputeHull ¶

    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 maxPolygonVertices points This welds close points and removes collinear points.

    @warning Do not modify a hull once it has been computed
    

    ComputePolygonAABB ¶

    ComputePolygonAABB :: proc "c" (#by_ptr shape: Polygon, transform: Transform) -> AABB ---
     

    Compute the bounding box of a transformed polygon

    ComputePolygonMass ¶

    ComputePolygonMass :: proc "c" (#by_ptr shape: Polygon, density: f32) -> MassData ---
     

    Compute mass properties of a polygon

    ComputeSegmentAABB ¶

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

    Compute the bounding box of a transformed line segment

    CreateBody ¶

    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 ¶

    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
    

    CreateChain ¶

    CreateChain :: proc "c" (bodyId: BodyId, #by_ptr def: ChainDef) -> ChainId ---
     

    Create a chain shape

    @see b2ChainDef for details
    

    CreateCircleShape ¶

    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
    

    CreateDistanceJoint ¶

    CreateDistanceJoint :: proc "c" (worldId: WorldId, #by_ptr def: DistanceJointDef) -> JointId ---
     

    Create a distance joint

    @see b2DistanceJointDef for details
    

    CreateMotorJoint ¶

    CreateMotorJoint :: proc "c" (worldId: WorldId, def: MotorJointDef) -> JointId ---
     

    Create a motor joint

    @see b2MotorJointDef for details
    

    CreateMouseJoint ¶

    CreateMouseJoint :: proc "c" (worldId: WorldId, #by_ptr def: MouseJointDef) -> JointId ---
     

    Create a mouse joint

    @see b2MouseJointDef for details
    

    CreatePolygonShape ¶

    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
    

    CreatePrismaticJoint ¶

    CreatePrismaticJoint :: proc "c" (worldId: WorldId, #by_ptr def: PrismaticJointDef) -> JointId ---
     

    Create a prismatic (slider) joint.

    @see b2PrismaticJointDef for details
    

    CreateRevoluteJoint ¶

    CreateRevoluteJoint :: proc "c" (worldId: WorldId, #by_ptr def: RevoluteJointDef) -> JointId ---
     

    Create a revolute joint

    @see b2RevoluteJointDef for details
    

    CreateSegmentShape ¶

    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
    

    CreateTimer ¶

    CreateTimer :: proc "c" () -> Timer ---

    CreateWeldJoint ¶

    CreateWeldJoint :: proc "c" (worldId: WorldId, #by_ptr def: WeldJointDef) -> JointId ---
     

    Create a weld joint

    @see b2WeldJointDef for details
    

    CreateWheelJoint ¶

    CreateWheelJoint :: proc "c" (worldId: WorldId, #by_ptr def: WheelJointDef) -> JointId ---
     

    Create a wheel joint

    @see b2WheelJointDef for details
    

    CreateWorld ¶

    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 ¶

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

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

    CrossSV ¶

    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 ¶

    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 ¶

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

    Use this to initialize your body definition @ingroup body

    DefaultChainDef ¶

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

    Use this to initialize your chain definition @ingroup shape

    DefaultDistanceJointDef ¶

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

    Use this to initialize your joint definition @ingroup distance_joint

    DefaultFilter ¶

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

    Use this to initialize your filter @ingroup shape

    DefaultMotorJointDef ¶

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

    Use this to initialize your joint definition @ingroup motor_joint

    DefaultMouseJointDef ¶

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

    Use this to initialize your joint definition @ingroup mouse_joint

    DefaultPrismaticJointDef ¶

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

    Use this to initialize your joint definition @ingroupd prismatic_joint

    DefaultQueryFilter ¶

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

    Use this to initialize your query filter @ingroup shape

    DefaultRevoluteJointDef ¶

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

    Use this to initialize your joint definition. @ingroup revolute_joint

    DefaultShapeDef ¶

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

    Use this to initialize your shape definition @ingroup shape

    DefaultWeldJointDef ¶

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

    Use this to initialize your joint definition @ingroup weld_joint

    DefaultWheelJointDef ¶

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

    Use this to initialize your joint definition @ingroup wheel_joint

    DefaultWorldDef ¶

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

    Use this to initialize your world definition @ingroup world

    DestroyBody ¶

    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.
    

    DestroyChain ¶

    DestroyChain :: proc "c" (chainId: ChainId) ---
     

    Destroy a chain shape

    DestroyJoint ¶

    DestroyJoint :: proc "c" (jointId: JointId) ---
     

    Destroy a joint

    DestroyShape ¶

    DestroyShape :: proc "c" (shapeId: ShapeId) ---
     

    Destroy a shape

    DestroyWorld ¶

    DestroyWorld :: proc "c" (worldId: WorldId) ---
     

    Destroy a world

    Distance ¶

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

    Get the distance between two points

    DistanceJoint_EnableLimit ¶

    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 ¶

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

    Enable/disable the distance joint motor

    DistanceJoint_EnableSpring ¶

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

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

    DistanceJoint_GetCurrentLength ¶

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

    Get the current length of a distance joint

    DistanceJoint_GetDampingRatio ¶

    DistanceJoint_GetDampingRatio :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the spring damping ratio

    DistanceJoint_GetHertz ¶

    DistanceJoint_GetHertz :: proc "c" (jointId: JointId) -> f32 ---
     

    Get the spring Hertz

    DistanceJoint_GetLength ¶

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

    Get the rest length of a distance joint

    DistanceJoint_GetMaxLength ¶

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

    Get the distance joint maximum length

    DistanceJoint_GetMaxMotorForce ¶

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

    Get the distance joint maximum motor force, typically in newtons

    DistanceJoint_GetMinLength ¶

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

    Get the distance joint minimum length

    DistanceJoint_GetMotorForce ¶

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

    Get the distance joint current motor force, typically in newtons

    DistanceJoint_GetMotorSpeed ¶

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

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

    DistanceJoint_IsLimitEnabled ¶

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

    Is the distance joint limit enabled?

    DistanceJoint_IsMotorEnabled ¶

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

    Is the distance joint motor enabled?

    DistanceJoint_IsSpringEnabled ¶

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

    Is the distance joint spring enabled?

    DistanceJoint_SetLength ¶

    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 ¶

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

    Set the minimum and maximum length parameters of a distance joint

    DistanceJoint_SetMaxMotorForce ¶

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

    Set the distance joint maximum motor force, typically in newtons

    DistanceJoint_SetMotorSpeed ¶

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

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

    DistanceJoint_SetSpringDampingRatio ¶

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

    Set the spring damping ratio, non-dimensional

    DistanceJoint_SetSpringHertz ¶

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

    Set the spring stiffness in Hertz

    DistanceSquared ¶

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

    Get the distance squared between points

    Dot ¶

    Dot :: proc "c" (a, b: [2]f32) -> f32 {…}
     

    Vector dot product

    DynamicTree_Create ¶

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

    Constructing the tree initializes the node pool.

    DynamicTree_CreateProxy ¶

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

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

    DynamicTree_Destroy ¶

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

    Destroy the tree, freeing the node pool.

    DynamicTree_DestroyProxy ¶

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

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

    DynamicTree_EnlargeProxy ¶

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

    Enlarge a proxy and enlarge ancestors as necessary.

    DynamicTree_GetAABB ¶

    DynamicTree_GetAABB :: proc "contextless" (tree: DynamicTree, proxyId: i32) -> AABB {…}
     

    Get the AABB of a proxy

    DynamicTree_GetAreaRatio ¶

    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 ¶

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

    Get the number of bytes used by this tree

    DynamicTree_GetHeight ¶

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

    Compute the height of the binary tree in O(N) time. Should not be called often.

    DynamicTree_GetMaxBalance ¶

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

    Get the maximum balance of the tree. The balance is the difference in height of the two children of a node.

    DynamicTree_GetProxyCount ¶

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

    Get the number of proxies created

    DynamicTree_GetUserData ¶

    DynamicTree_GetUserData :: proc "contextless" (tree: DynamicTree, proxyId: i32) -> i32 {…}
     

    Get proxy user data @return the proxy user data or 0 if the id is invalid

    DynamicTree_MoveProxy ¶

    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_Query ¶

    DynamicTree_Query :: proc "c" (#by_ptr tree: DynamicTree, aabb: AABB, maskBits: u32, callback: TreeQueryCallbackFcn, ctx: rawptr) ---
     

    Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB.

    DynamicTree_RayCast ¶

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

    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.
    @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 ray

    @param context user context that is passed to the callback
    

    DynamicTree_Rebuild ¶

    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_RebuildBottomUp ¶

    DynamicTree_RebuildBottomUp :: proc "c" (tree: ^DynamicTree) ---
     

    Build an optimal tree. Very expensive. For testing.

    DynamicTree_ShapeCast ¶

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

    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
    

    DynamicTree_ShiftOrigin ¶

    DynamicTree_ShiftOrigin :: proc "c" (tree: ^DynamicTree, newOrigin: [2]f32) ---
     

    Shift the world origin. Useful for large worlds. The shift formula is: position -= newOrigin @param tree the tree to shift @param newOrigin the new origin with respect to the old origin

    DynamicTree_Validate ¶

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

    Validate this tree. For testing.

    Float_IsValid ¶

    Float_IsValid :: proc "c" (a: f32) -> bool {…}

    GetByteCount ¶

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

    @return the total bytes allocated by Box2D

    GetInverse22 ¶

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

    Get the inverse of a 2-by-2 matrix

    GetLengthAndNormalize ¶

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

    GetLengthUnitsPerMeter ¶

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

    Get the current length units per meter.

    GetMilliseconds ¶

    GetMilliseconds :: proc "c" (#by_ptr timer: Timer) -> f32 ---

    GetMillisecondsAndReset ¶

    GetMillisecondsAndReset :: proc "c" (timer: ^Timer) -> f32 ---

    GetSweepTransform ¶

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

    Evaluate the transform sweep at a specific time.

    GetTicks ¶

    GetTicks :: proc "c" (timer: ^Timer) -> i64 ---

    ID_EQUALS ¶

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

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

    IS_NON_NULL ¶

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

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

    IS_NULL ¶

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

    / Macro to determine if any id is null.

    IntegrateRotation ¶

    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 ¶

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

    Transpose multiply two rotations: qT * r

    InvMulTransforms ¶

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

    v2 = A.q' (B.q v1 + B.p - A.p) = A.q' B.q v1 + A.q' * (B.p - A.p)

    InvRotateVector ¶

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

    Inverse rotate a vector

    InvTransformPoint ¶

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

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

    IsNormalized ¶

    IsNormalized :: proc "c" (q: Rot) -> bool {…}
     

    Is this rotation normalized?

    IsValidRay ¶

    IsValidRay :: proc "c" (#by_ptr input: RayCastInput) -> bool ---
     

    Validate ray cast input data (NaN, etc)

    Joint_GetBodyA ¶

    Joint_GetBodyA :: proc "c" (jointId: JointId) -> BodyId ---
     

    Get body A id on a joint

    Joint_GetBodyB ¶

    Joint_GetBodyB :: proc "c" (jointId: JointId) -> BodyId ---
     

    Get body B id on a joint

    Joint_GetCollideConnected ¶

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

    Is collision allowed between connected bodies?

    Joint_GetConstraintForce ¶

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

    Get the current constraint force for this joint

    Joint_GetConstraintTorque ¶

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

    Get the current constraint torque for this joint

    Joint_GetLocalAnchorA ¶

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

    Get the local anchor on bodyA

    Joint_GetLocalAnchorB ¶

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

    Get the local anchor on bodyB

    Joint_GetType ¶

    Joint_GetType :: proc "c" (jointId: JointId) -> JointType ---
     

    Get the joint type

    Joint_GetUserData ¶

    Joint_GetUserData :: proc "c" (jointId: JointId) -> rawptr ---
     

    Get the user data on a joint

    Joint_IsValid ¶

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

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

    Joint_SetCollideConnected ¶

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

    Toggle collision between connected bodies

    Joint_SetUserData ¶

    Joint_SetUserData :: proc "c" (jointId: JointId, userData: rawptr) ---
     

    Set the user data on a joint

    Joint_WakeBodies ¶

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

    Wake the bodies connect to this joint

    LeftPerp ¶

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

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

    Length ¶

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

    Get the length of this vector (the norm)

    LengthSquared ¶

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

    Get the length squared of this vector

    Lerp ¶

    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/

    MakeBox ¶

    MakeBox :: proc "c" (hx, hy: f32) -> Polygon ---
     

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

    MakeOffsetBox ¶

    MakeOffsetBox :: proc "c" (hx, hy: f32, center: [2]f32, angle: f32) -> Polygon ---
     

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

    MakeOffsetPolygon ¶

    MakeOffsetPolygon :: proc "c" (#by_ptr hull: Hull, radius: f32, transform: Transform) -> 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 ¶

    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 ¶

    MakeProxy :: proc "c" (vertices: [][2]f32, radius: f32) -> DistanceProxy {…}
     

    Make a proxy for use in GJK and related functions.

    MakeRot ¶

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

    Make a rotation using an angle in radians

    MakeRoundedBox ¶

    MakeRoundedBox :: proc "c" (hx, hy: f32, radius: f32) -> Polygon ---
     

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

    MakeSquare ¶

    MakeSquare :: proc "c" (h: f32) -> Polygon ---
     

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

    Max ¶

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

    Component-wise maximum vector

    MaxFloat ¶

    MaxFloat :: proc "c" (a, b: f32) -> f32 {…}
     

    @return the maximum of two floats

    MaxInt ¶

    MaxInt :: proc "c" (a, b: i32) -> i32 {…}
     

    @return the maximum of two integers

    Min ¶

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

    Component-wise minimum vector

    MinFloat ¶

    MinFloat :: proc "c" (a, b: f32) -> f32 {…}
     

    @return the minimum of two floats

    MinInt ¶

    MinInt :: proc "c" (a, b: i32) -> i32 {…}
     

    @return the minimum of two integers

    MotorJoint_GetAngularOffset ¶

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

    Get the motor joint angular offset target in radians

    MotorJoint_GetCorrectionFactor ¶

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

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

    MotorJoint_GetLinearOffset ¶

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

    Get the motor joint linear offset target

    MotorJoint_GetMaxForce ¶

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

    Get the motor joint maximum force, typically in newtons

    MotorJoint_GetMaxTorque ¶

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

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

    MotorJoint_SetAngularOffset ¶

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

    Set the motor joint angular offset target in radians

    MotorJoint_SetCorrectionFactor ¶

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

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

    MotorJoint_SetLinearOffset ¶

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

    Set the motor joint linear offset target

    MotorJoint_SetMaxForce ¶

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

    Set the motor joint maximum force, typically in newtons

    MotorJoint_SetMaxTorque ¶

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

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

    MouseJoint_GetMaxForce ¶

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

    Get the mouse joint maximum force, typically in newtons

    MouseJoint_GetSpringDampingRatio ¶

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

    Get the mouse joint damping ratio, non-dimensional

    MouseJoint_GetSpringHertz ¶

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

    Get the mouse joint spring stiffness in Hertz

    MouseJoint_GetTarget ¶

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

    Get the mouse joint target

    MouseJoint_SetMaxForce ¶

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

    Set the mouse joint maximum force, typically in newtons

    MouseJoint_SetSpringDampingRatio ¶

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

    Set the mouse joint spring damping ratio, non-dimensional

    MouseJoint_SetSpringHertz ¶

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

    Set the mouse joint spring stiffness in Hertz

    MouseJoint_SetTarget ¶

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

    Set the mouse joint target

    Mul ¶

    Mul :: proc "c" (a, b: [2]f32) -> [2]f32 {…}
     

    Component-wise multiplication

    MulAdd ¶

    MulAdd :: proc "c" (a: [2]f32, s: f32, b: [2]f32) -> [2]f32 {…}
     

    a + s * b

    MulMV ¶

    MulMV :: proc "c" (A: matrix[2, 2]f32, v: [2]f32) -> [2]f32 {…}
     

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

    MulRot ¶

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

    Multiply two rotations: q * r

    MulSV ¶

    MulSV :: proc "c" (s: f32, v: [2]f32) -> [2]f32 {…}
     

    Multiply a scalar and vector

    MulSub ¶

    MulSub :: proc "c" (a: [2]f32, s: f32, b: [2]f32) -> [2]f32 {…}
     

    a - s * b

    MulTransforms ¶

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

    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

    NLerp ¶

    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/

    Neg ¶

    Neg :: proc "c" (a: [2]f32) -> [2]f32 {…}
     

    Vector negation

    Normalize ¶

    Normalize :: proc "c" (v: [2]f32) -> [2]f32 {…}

    NormalizeChecked ¶

    NormalizeChecked :: proc(v: [2]f32) -> [2]f32 {…}

    NormalizeRot ¶

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

    Normalize rotation

    PointInCapsule ¶

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

    Test a point for overlap with a capsule in local space

    PointInCircle ¶

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

    Test a point for overlap with a circle in local space

    PointInPolygon ¶

    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 ¶

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

    Enable/disable a prismatic joint limit

    PrismaticJoint_EnableMotor ¶

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

    Enable/disable a prismatic joint motor

    PrismaticJoint_EnableSpring ¶

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

    Enable/disable the joint spring.

    PrismaticJoint_GetLowerLimit ¶

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

    Get the prismatic joint lower limit

    PrismaticJoint_GetMaxMotorForce ¶

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

    Get the prismatic joint maximum motor force, typically in newtons

    PrismaticJoint_GetMotorForce ¶

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

    Get the prismatic joint current motor force, typically in newtons

    PrismaticJoint_GetMotorSpeed ¶

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

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

    PrismaticJoint_GetSpringDampingRatio ¶

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

    Get the prismatic spring damping ratio (non-dimensional)

    PrismaticJoint_GetSpringHertz ¶

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

    Get the prismatic joint stiffness in Hertz

    PrismaticJoint_GetUpperLimit ¶

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

    Get the prismatic joint upper limit

    PrismaticJoint_IsLimitEnabled ¶

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

    Is the prismatic joint limit enabled?

    PrismaticJoint_IsMotorEnabled ¶

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

    Is the prismatic joint motor enabled?

    PrismaticJoint_IsSpringEnabled ¶

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

    Is the prismatic joint spring enabled or not?

    PrismaticJoint_SetLimits ¶

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

    Set the prismatic joint limits

    PrismaticJoint_SetMaxMotorForce ¶

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

    Set the prismatic joint maximum motor force, typically in newtons

    PrismaticJoint_SetMotorSpeed ¶

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

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

    PrismaticJoint_SetSpringDampingRatio ¶

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

    Set the prismatic joint damping ratio (non-dimensional)

    PrismaticJoint_SetSpringHertz ¶

    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.

    RayCastCapsule ¶

    RayCastCapsule :: proc "c" (#by_ptr input: RayCastInput, #by_ptr shape: Capsule) -> CastOutput ---
     

    Ray cast versus capsule in shape local space. Initial overlap is treated as a miss.

    RayCastCircle ¶

    RayCastCircle :: proc "c" (#by_ptr input: RayCastInput, #by_ptr shape: Circle) -> CastOutput ---
     

    Ray cast versus circle in shape local space. Initial overlap is treated as a miss.

    RayCastPolygon ¶

    RayCastPolygon :: proc "c" (#by_ptr input: RayCastInput, #by_ptr shape: Polygon) -> CastOutput ---
     

    Ray cast versus polygon in shape local space. Initial overlap is treated as a miss.

    RayCastSegment ¶

    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 ¶

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

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

    RevoluteJoint_EnableLimit ¶

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

    Enable/disable the revolute joint limit

    RevoluteJoint_EnableMotor ¶

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

    Enable/disable a revolute joint motor

    RevoluteJoint_EnableSpring ¶

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

    Enable/disable the revolute joint spring

    RevoluteJoint_GetAngle ¶

    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 ¶

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

    Get the revolute joint lower limit in radians

    RevoluteJoint_GetMaxMotorTorque ¶

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

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

    RevoluteJoint_GetMotorSpeed ¶

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

    Get the revolute joint motor speed in radians per second

    RevoluteJoint_GetMotorTorque ¶

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

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

    RevoluteJoint_GetSpringDampingRatio ¶

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

    Get the revolute joint spring damping ratio, non-dimensional

    RevoluteJoint_GetSpringHertz ¶

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

    Get the revolute joint spring stiffness in Hertz

    RevoluteJoint_GetUpperLimit ¶

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

    Get the revolute joint upper limit in radians

    RevoluteJoint_IsLimitEnabled ¶

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

    Is the revolute joint limit enabled?

    RevoluteJoint_IsMotorEnabled ¶

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

    Is the revolute joint motor enabled?

    RevoluteJoint_SetLimits ¶

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

    Set the revolute joint limits in radians

    RevoluteJoint_SetMaxMotorTorque ¶

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

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

    RevoluteJoint_SetMotorSpeed ¶

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

    Set the revolute joint motor speed in radians per second

    RevoluteJoint_SetSpringDampingRatio ¶

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

    Set the revolute joint spring damping ratio, non-dimensional

    RevoluteJoint_SetSpringHertz ¶

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

    Set the revolute joint spring stiffness in Hertz

    RightPerp ¶

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

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

    Rot_GetAngle ¶

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

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

    Rot_GetXAxis ¶

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

    Get the x-axis

    Rot_GetYAxis ¶

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

    Get the y-axis

    Rot_IsValid ¶

    Rot_IsValid :: proc "c" (q: Rot) -> bool {…}

    RotateVector ¶

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

    Rotate a vector

    SegmentDistance ¶

    SegmentDistance :: proc "c" (p1, q1: [2]f32, p2, q2: [2]f32) -> SegmentDistanceResult ---
     

    Compute the distance between two line segments, clamping at the end points if needed.

    SetAllocator ¶

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

    This allows the user to override the allocation functions. These should be

    set during application startup.
    

    SetAssertFcn ¶

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

    Override the default assert callback

    @param assertFcn a non-null assert callback
    

    SetLengthUnitsPerMeter ¶

    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.
    @warning This must be modified before any calls to Box2D
    

    ShapeCast ¶

    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.

    ShapeCastCapsule ¶

    ShapeCastCapsule :: proc "c" (#by_ptr input: ShapeCastInput, #by_ptr shape: Capsule) -> CastOutput ---
     

    Shape cast versus a capsule. Initial overlap is treated as a miss.

    ShapeCastCircle ¶

    ShapeCastCircle :: proc "c" (#by_ptr input: ShapeCastInput, #by_ptr shape: Circle) -> CastOutput ---
     

    Shape cast versus a circle. Initial overlap is treated as a miss.

    ShapeCastPolygon ¶

    ShapeCastPolygon :: proc "c" (#by_ptr input: ShapeCastInput, #by_ptr shape: Polygon) -> CastOutput ---
     

    Shape cast versus a convex polygon. Initial overlap is treated as a miss.

    ShapeCastSegment ¶

    ShapeCastSegment :: proc "c" (#by_ptr input: ShapeCastInput, #by_ptr shape: Segment) -> CastOutput ---
     

    Shape cast versus a line segment. Initial overlap is treated as a miss.

    ShapeDistance ¶

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

    Compute the closest points between two shapes represented as point clouds. DistanceCache cache is input/output. On the first call set DistanceCache.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.
    

    Shape_AreContactEventsEnabled ¶

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

    Returns true if contact events are enabled

    Shape_AreHitEventsEnabled ¶

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

    Returns true if hit events are enabled

    Shape_ArePreSolveEventsEnabled ¶

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

    Returns true if pre-solve events are enabled

    Shape_AreSensorEventsEnabled ¶

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

    Returns true if sensor events are enabled

    Shape_EnableContactEvents ¶

    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
    

    Shape_EnableHitEvents ¶

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

    Enable contact hit events for this shape. Ignored for sensors.

    @see WorldDef.hitEventThreshold
    

    Shape_EnablePreSolveEvents ¶

    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 ¶

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

    Enable sensor events for this shape. Only applies to kinematic and dynamic bodies. Ignored for sensors.

    @see b2ShapeDef::isSensor
    

    Shape_GetAABB ¶

    Shape_GetAABB :: proc "c" (shapeId: ShapeId) -> AABB ---
     

    Get the current world AABB

    Shape_GetBody ¶

    Shape_GetBody :: proc "c" (shapeId: ShapeId) -> BodyId ---
     

    Get the id of the body that a shape is attached to

    Shape_GetCapsule ¶

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

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

    Shape_GetCircle ¶

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

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

    Shape_GetClosestPoint ¶

    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 ¶

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

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

    Shape_GetContactData ¶

    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 ¶

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

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

    Shape_GetFilter ¶

    Shape_GetFilter :: proc "c" (shapeId: ShapeId) -> Filter ---
     

    Get the shape filter

    Shape_GetFriction ¶

    Shape_GetFriction :: proc "c" (shapeId: ShapeId) -> f32 ---
     

    Get the friction of a shape

    Shape_GetParentChain ¶

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

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

    Shape_GetPolygon ¶

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

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

    Shape_GetRestitution ¶

    Shape_GetRestitution :: proc "c" (shapeId: ShapeId) -> f32 ---
     

    Get the shape restitution

    Shape_GetSegment ¶

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

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

    Shape_GetSmoothSegment ¶

    Shape_GetSmoothSegment :: proc "c" (shapeId: ShapeId) -> SmoothSegment ---
     

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

    Shape_GetType ¶

    Shape_GetType :: proc "c" (shapeId: ShapeId) -> ShapeType ---
     

    Get the type of a shape

    Shape_GetUserData ¶

    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 ¶

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

    Returns true If the shape is a sensor

    Shape_IsValid ¶

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

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

    Shape_RayCast ¶

    Shape_RayCast :: proc "c" (shapeId: ShapeId, origin: [2]f32, translation: [2]f32) -> CastOutput ---
     

    Ray cast a shape directly

    Shape_SetCapsule ¶

    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 ¶

    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 ¶

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

    Set the mass density of a shape, typically in kg/m^2.

    This will not update the mass properties on the parent body.
    @see b2ShapeDef::density, b2Body_ApplyMassFromShapes
    

    Shape_SetFilter ¶

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

    Set the current filter. This is almost as expensive as recreating the shape.

    @see b2ShapeDef::filter
    

    Shape_SetFriction ¶

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

    Set the friction on a shape

    @see b2ShapeDef::friction
    

    Shape_SetPolygon ¶

    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 ¶

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

    Set the shape restitution (bounciness)

    @see b2ShapeDef::restitution
    

    Shape_SetSegment ¶

    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.

    Shape_SetUserData ¶

    Shape_SetUserData :: proc "c" (shapeId: ShapeId, userData: rawptr) ---
     

    Set the user data for a shape

    Shape_TestPoint ¶

    Shape_TestPoint :: proc "c" (shapeId: ShapeId, point: [2]f32) -> bool ---
     

    Test a point for overlap with a shape

    SleepMilliseconds ¶

    SleepMilliseconds :: proc "c" (milliseconds: i32) ---

    Solve22 ¶

    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 ¶

    Sub :: proc "c" (a, b: [2]f32) -> [2]f32 {…}
     

    Vector subtraction

    TimeOfImpact ¶

    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 ¶

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

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

    TransformPolygon ¶

    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 ¶

    UnwindAngle :: proc "c" (angle: f32) -> f32 {…}
     

    Convert an angle in the range [-2pi, 2pi] into the range [-pi, pi]

    ValidateHull ¶

    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.

    Vec2_IsValid ¶

    Vec2_IsValid :: proc "c" (v: [2]f32) -> bool {…}

    WeldJoint_GetAngularDampingRatio ¶

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

    Get the weld joint angular damping ratio, non-dimensional

    WeldJoint_GetAngularHertz ¶

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

    Get the weld joint angular stiffness in Hertz

    WeldJoint_GetLinearDampingRatio ¶

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

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

    WeldJoint_GetLinearHertz ¶

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

    Get the weld joint linear stiffness in Hertz

    WeldJoint_SetAngularDampingRatio ¶

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

    Set weld joint angular damping ratio, non-dimensional

    WeldJoint_SetAngularHertz ¶

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

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

    WeldJoint_SetLinearDampingRatio ¶

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

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

    WeldJoint_SetLinearHertz ¶

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

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

    WheelJoint_EnableLimit ¶

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

    Enable/disable the wheel joint limit

    WheelJoint_EnableMotor ¶

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

    Enable/disable the wheel joint motor

    WheelJoint_EnableSpring ¶

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

    Enable/disable the wheel joint spring

    WheelJoint_GetLowerLimit ¶

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

    Get the wheel joint lower limit

    WheelJoint_GetMaxMotorTorque ¶

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

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

    WheelJoint_GetMotorSpeed ¶

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

    Get the wheel joint motor speed in radians per second

    WheelJoint_GetMotorTorque ¶

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

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

    WheelJoint_GetSpringDampingRatio ¶

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

    Get the wheel joint damping ratio, non-dimensional

    WheelJoint_GetSpringHertz ¶

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

    Get the wheel joint stiffness in Hertz

    WheelJoint_GetUpperLimit ¶

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

    Get the wheel joint upper limit

    WheelJoint_IsLimitEnabled ¶

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

    Is the wheel joint limit enabled?

    WheelJoint_IsMotorEnabled ¶

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

    Is the wheel joint motor enabled?

    WheelJoint_IsSpringEnabled ¶

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

    Is the wheel joint spring enabled?

    WheelJoint_SetLimits ¶

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

    Set the wheel joint limits

    WheelJoint_SetMaxMotorTorque ¶

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

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

    WheelJoint_SetMotorSpeed ¶

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

    Set the wheel joint motor speed in radians per second

    WheelJoint_SetSpringDampingRatio ¶

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

    Set the wheel joint damping ratio, non-dimensional

    WheelJoint_SetSpringHertz ¶

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

    Set the wheel joint stiffness in Hertz

    World_CastCapsule ¶

    World_CastCapsule :: proc "c" (
    	worldId:         WorldId, 
    	#by_ptr capsule: Capsule, 
    	originTransform: Transform, 
    	translation:     [2]f32, 
    	filter:          QueryFilter, 
    	fcn:             CastResultFcn, 
    	ctx:             rawptr, 
    ) ---
     

    Cast a capsule through the world. Similar to a cast ray except that a capsule is cast instead of a point.

    World_CastCircle ¶

    World_CastCircle :: proc "c" (
    	worldId:         WorldId, 
    	#by_ptr circle:  Circle, 
    	originTransform: Transform, 
    	translation:     [2]f32, 
    	filter:          QueryFilter, 
    	fcn:             CastResultFcn, 
    	ctx:             rawptr, 
    ) ---
     

    Cast a circle through the world. Similar to a cast ray except that a circle is cast instead of a point.

    World_CastPolygon ¶

    World_CastPolygon :: proc "c" (
    	worldId:         WorldId, 
    	#by_ptr polygon: Polygon, 
    	originTransform: Transform, 
    	translation:     [2]f32, 
    	filter:          QueryFilter, 
    	fcn:             CastResultFcn, 
    	ctx:             rawptr, 
    ) ---
     

    Cast a polygon through the world. Similar to a cast ray except that a polygon is cast instead of a point.

    World_CastRay ¶

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

    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. The ray-cast ignores shapes that contain the starting point.

    @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

    @note The callback function may receive shapes in any order
    

    World_CastRayClosest ¶

    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. This is less general than b2World_CastRay() and does not allow for custom filtering.

    World_Draw ¶

    World_Draw :: proc "c" (worldId: WorldId, draw: ^DebugDraw) ---
     

    Call this to draw shapes and other debug draw data

    World_DumpMemoryStats ¶

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

    Dump memory stats to box2d_memory.txt

    World_EnableContinuous ¶

    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 ¶

    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_EnableWarmStarting ¶

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

    Enable/disable constraint warm starting. Advanced feature for testing. Disabling

    sleeping greatly reduces stability and provides no performance gain.
    

    World_Explode ¶

    World_Explode :: proc "c" (worldId: WorldId, position: [2]f32, radius: f32, impulse: f32) ---
     

    Apply a radial explosion

    @param worldId The world id
    @param position The center of the explosion
    @param radius The radius of the explosion
    @param impulse The impulse of the explosion, typically in kg * m / s or N * s.
    

    World_GetBodyEvents ¶

    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 ¶

    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_GetCounters ¶

    World_GetCounters :: proc "c" (worldId: WorldId) -> Counters ---
     

    Get world counters and sizes

    World_GetGravity ¶

    World_GetGravity :: proc "c" (worldId: WorldId) -> [2]f32 ---
     

    Get the gravity vector

    World_GetProfile ¶

    World_GetProfile :: proc "c" (worldId: WorldId) -> Profile ---
     

    Get the current world performance profile

    World_GetSensorEvents ¶

    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_IsValid ¶

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

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

    World_OverlapAABB ¶

    World_OverlapAABB :: proc "c" (worldId: WorldId, aabb: AABB, filter: QueryFilter, fcn: OverlapResultFcn, ctx: rawptr) ---
     

    Overlap test for all shapes that potentially overlap the provided AABB

    World_OverlapCapsule ¶

    World_OverlapCapsule :: proc "c" (
    	worldId:   WorldId, 
    	#by_ptr capsule: Capsule, 
    	transform: Transform, 
    	filter:    QueryFilter, 
    	fcn:       OverlapResultFcn, 
    	ctx:       rawptr, 
    ) ---
     

    Overlap test for all shapes that overlap the provided capsule

    World_OverlapCircle ¶

    World_OverlapCircle :: proc "c" (
    	worldId:   WorldId, 
    	#by_ptr circle: Circle, 
    	transform: Transform, 
    	filter:    QueryFilter, 
    	fcn:       OverlapResultFcn, 
    	ctx:       rawptr, 
    ) ---
     

    Overlap test for for all shapes that overlap the provided circle

    World_OverlapPolygon ¶

    World_OverlapPolygon :: proc "c" (
    	worldId:   WorldId, 
    	#by_ptr polygon: Polygon, 
    	transform: Transform, 
    	filter:    QueryFilter, 
    	fcn:       OverlapResultFcn, 
    	ctx:       rawptr, 
    ) ---
     

    Overlap test for all shapes that overlap the provided polygon

    World_SetContactTuning ¶

    World_SetContactTuning :: proc "c" (worldId: WorldId, hertz: f32, dampingRatio: f32, pushVelocity: 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 pushVelocity The maximum contact constraint push out velocity (meters per second)

    @note Advanced feature
    

    World_SetCustomFilterCallback ¶

    World_SetCustomFilterCallback :: proc "c" (worldId: WorldId, fcn: CustomFilterFcn, ctx: rawptr) ---
     

    Register the custom filter callback. This is optional.

    World_SetGravity ¶

    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. Typically in m/s^2.

    @see WorldDef
    

    World_SetHitEventThreshold ¶

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

    Adjust the hit event threshold. This controls the collision velocity needed to generate a b2ContactHitEvent. Typically in meters per second.

    @see WorldDef::hitEventThreshold
    

    World_SetPreSolveCallback ¶

    World_SetPreSolveCallback :: proc "c" (worldId: WorldId, fcn: PreSolveFcn, ctx: rawptr) ---
     

    Register the pre-solve callback. This is optional.

    World_SetRestitutionThreshold ¶

    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. Typically in meters per second.
    @see WorldDef
    

    World_Step ¶

    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. Typically 1/60. @param subStepCount The number of sub-steps, increasing the sub-step count can increase accuracy. Typically 4.

    Yield ¶

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

    Procedure Groups

    Source Files

    Generation Information

    Generated with odin version dev-2024-11 (vendor "odin") Windows_amd64 @ 2024-11-20 21:11:51.693633600 +0000 UTC