Box2D 3.2.0
A 2D physics engine for games
Loading...
Searching...
No Matches
constants.h
1// SPDX-FileCopyrightText: 2026 Erin Catto
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
6#include "math_functions.h"
7
14
19#if defined( BOX2D_DOUBLE_PRECISION )
20#define B2_HUGE ( ( 100000.0f * 1000.0f ) * b2_lengthUnitsPerMeter )
21#else
22#define B2_HUGE ( ( 100.0f * 1000.0f ) * b2_lengthUnitsPerMeter )
23#endif
24
26#define B2_MAX_WORKERS 32
27
32#define B2_MAX_TASKS 256
33
37#define B2_GRAPH_COLOR_COUNT 24
38
42#define B2_LINEAR_SLOP ( 0.005f * b2_lengthUnitsPerMeter )
43
45#ifndef B2_MAX_WORLDS
46#define B2_MAX_WORLDS 128
47#endif
48
50#ifndef B2_NAME_LENGTH
51#define B2_NAME_LENGTH 10
52#endif
53
57#define B2_MAX_ROTATION ( 0.25f * B2_PI )
58
61#define B2_SPECULATIVE_DISTANCE ( 4.0f * B2_LINEAR_SLOP )
62
64#define B2_CONTACT_RECYCLE_DISTANCE ( 10.0f * B2_LINEAR_SLOP )
65
67#define B2_CONTACT_RECYCLE_COS_ANGLE ( 0.98f )
68
76#define B2_MAX_AABB_MARGIN ( 0.05f * b2_lengthUnitsPerMeter )
77
79#define B2_AABB_MARGIN_FRACTION 0.125f
80
82#define B2_TIME_TO_SLEEP 0.5f
83
85#define B2_MAX_RESTITUTION_ITERATIONS 63
86