Box3D 0.1.0
A 3D physics engine for games
Loading...
Searching...
No Matches
types.h
1// SPDX-FileCopyrightText: 2025 Erin Catto
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
6#include "base.h"
7#include "constants.h"
8#include "id.h"
9#include "math_functions.h"
10
11#include <stdint.h>
12
13#define B3_DEFAULT_CATEGORY_BITS UINT64_MAX
14#define B3_DEFAULT_MASK_BITS UINT64_MAX
15
20typedef void b3TaskCallback( void* taskContext );
21
31typedef void* b3EnqueueTaskCallback( b3TaskCallback* task, void* taskContext, void* userContext, const char* taskName );
32
40typedef void b3FinishTaskCallback( void* userTask, void* userContext );
41
42typedef struct b3DebugShape b3DebugShape;
43
47typedef void* b3CreateDebugShapeCallback( const b3DebugShape* debugShape, void* userContext );
48typedef void b3DestroyDebugShapeCallback( void* userShape, void* userContext );
49
54typedef float b3FrictionCallback( float frictionA, uint64_t userMaterialIdA, float frictionB, uint64_t userMaterialIdB );
55
60typedef float b3RestitutionCallback( float restitutionA, uint64_t userMaterialIdA, float restitutionB, uint64_t userMaterialIdB );
61
73typedef bool b3CustomFilterFcn( b3ShapeId shapeIdA, b3ShapeId shapeIdB, void* context );
74
88typedef bool b3PreSolveFcn( b3ShapeId shapeIdA, b3ShapeId shapeIdB, b3Pos point, b3Vec3 normal, void* context );
89
95typedef bool b3OverlapResultFcn( b3ShapeId shapeId, void* context );
96
115typedef float b3CastResultFcn( b3ShapeId shapeId, b3Pos point, b3Vec3 normal, float fraction, uint64_t userMaterialId,
116 int triangleIndex, int childIndex, void* context );
117
137
216
220
238
241typedef struct b3MotionLocks
242{
245
248
251
254
257
261
350
354
358typedef struct b3Filter
359{
372 uint64_t categoryBits;
373
381 uint64_t maskBits;
382
390} b3Filter;
391
395
398typedef struct b3SurfaceMaterial
399{
401 float friction;
402
406
409
413
417
421 uint32_t customColor;
423
427
453
514
518
522typedef struct b3Profile
523{
524 float step;
525 float pairs;
526 float collide;
527 float solve;
528 float solverSetup;
529 float constraints;
530 float prepareConstraints;
531 float integrateVelocities;
532 float warmStart;
533 float solveImpulses;
534 float integratePositions;
535 float relaxImpulses;
536 float applyRestitution;
537 float storeImpulses;
538 float splitIslands;
539 float transforms;
540 float sensorHits;
541 float jointEvents;
542 float hitEvents;
543 float refit;
544 float bullets;
545 float sleepIslands;
546 float sensors;
547} b3Profile;
548
551typedef struct b3Counters
552{
553 int bodyCount;
554 int shapeCount;
555 int contactCount;
556 int jointCount;
557 int islandCount;
558 int stackUsed;
559 int arenaCapacity;
560 int staticTreeHeight;
561 int treeHeight;
562 int satCallCount;
563 int satCacheHitCount;
564 int byteCount;
565 int taskCount;
566 int colorCounts[24];
567 int manifoldCounts[B3_CONTACT_MANIFOLD_COUNT_BUCKETS];
568
571 int awakeContactCount;
572
574 int recycledContactCount;
575
577 int distanceIterations;
578 int pushBackIterations;
579 int rootIterations;
580} b3Counters;
582
586typedef enum b3JointType
587{
588 b3_parallelJoint,
589 b3_distanceJoint,
590 b3_filterJoint,
591 b3_motorJoint,
592 b3_prismaticJoint,
593 b3_revoluteJoint,
594 b3_sphericalJoint,
595 b3_weldJoint,
596 b3_wheelJoint,
598
642
647typedef struct b3DistanceJointDef
648{
651
653 float length;
654
658
661
664
666 float hertz;
667
670
673
676
679
682
685
689
693
731
735
743
747
751typedef struct b3ParallelJointDef
752{
755
757 float hertz;
758
761
764
766
770
811
815
819typedef struct b3RevoluteJointDef
820{
823
827
830
832 float hertz;
833
836
839
842
845
848
851
855
859
905
909
932
936
999
1003
1007typedef struct b3ExplosionDef
1008{
1010 uint64_t maskBits;
1011
1014
1016 float radius;
1017
1019 float falloff;
1020
1026
1030
1047
1057
1074
1092
1106
1128
1162
1186
1211
1223
1226typedef struct b3JointEvent
1227{
1230
1233} b3JointEvent;
1234
1246
1269 // event
1271
1279
1283typedef struct b3QueryFilter
1284{
1287
1290 uint64_t maskBits;
1291
1294 uint64_t id;
1295
1300 const char* name;
1302
1305
1319
1321typedef struct b3RayResult
1322{
1325
1328
1331
1335
1338
1342
1345
1348
1351
1353 bool hit;
1354} b3RayResult;
1355
1357typedef struct b3ShapeProxy
1358{
1361
1364
1366 float radius;
1367} b3ShapeProxy;
1368
1386
1401
1403typedef struct b3CastOutput
1404{
1407
1410
1413
1416
1419
1422
1425
1427 bool hit;
1428} b3CastOutput;
1429
1430#if defined( BOX3D_DOUBLE_PRECISION )
1431
1434typedef struct b3WorldCastOutput
1435{
1437 b3Vec3 normal;
1438
1440 b3Pos point;
1441
1443 float fraction;
1444
1446 int iterations;
1447
1449 int triangleIndex;
1450
1452 int childIndex;
1453
1455 int materialIndex;
1456
1458 bool hit;
1460
1461#else
1462
1465
1466#endif
1467
1469typedef struct b3BodyCastResult
1470{
1473
1476
1479
1483
1486
1490
1493
1495 bool hit;
1497
1502typedef struct b3SimplexCache
1503{
1505 float metric;
1506
1507 // todo use an index of 0xFF as a sentinel and remove the count
1509 uint16_t count;
1510
1512 uint8_t indexA[4];
1513
1515 uint8_t indexB[4];
1516
1518
1519static const b3SimplexCache b3_emptyDistanceCache = B3_ZERO_INIT;
1520
1531
1548
1559
1570
1572typedef struct b3Simplex
1573{
1575 int count;
1576} b3Simplex;
1577
1589
1599
1601typedef enum b3TOIState
1602{
1603 b3_toiStateUnknown,
1604 b3_toiStateFailed,
1605 b3_toiStateOverlapped,
1606 b3_toiStateHit,
1607 b3_toiStateSeparated
1608} b3TOIState;
1609
1642 // query
1644
1662
1665{
1666 b3_allocatedNode = 0x0001,
1667 b3_enlargedNode = 0x0002,
1668 b3_leafNode = 0x0004,
1670
1673{
1677
1680typedef struct b3TreeNode
1681{
1684
1686 uint64_t categoryBits; // 8
1687
1688 union
1689 {
1692
1694 uint64_t userData;
1695 }; // 8
1696
1697 union
1698 {
1700 int parent;
1701
1703 int next;
1704 }; // 4
1705
1707 uint16_t height; // 2
1708
1710 uint16_t flags; // 2
1711} b3TreeNode;
1712
1714#define B3_DYNAMIC_TREE_VERSION 0x93EDAF889FD30B4Aull
1715
1718typedef struct b3DynamicTree
1719{
1722 uint64_t version;
1723
1726
1728 int root;
1729
1732
1735
1738
1741
1744
1747
1750
1753
1757
1759typedef struct b3TreeStats
1760{
1763
1766} b3TreeStats;
1767
1770typedef bool b3TreeQueryCallbackFcn( int proxyId, uint64_t userData, void* context );
1771
1774typedef float b3TreeQueryClosestCallbackFcn( float distanceSqrMin, int proxyId, uint64_t userData, void* context );
1775
1781typedef float b3TreeBoxCastCallbackFcn( const b3BoxCastInput* input, int proxyId, uint64_t userData, void* context );
1782
1788typedef float b3TreeRayCastCallbackFcn( const b3RayCastInput* input, int proxyId, uint64_t userData, void* context );
1789 // tree
1791
1797
1799typedef struct b3PlaneResult
1800{
1803
1806
1808
1811typedef struct b3CollisionPlane
1812{
1815
1819
1821 float push;
1822
1826
1836
1846
1849typedef bool b3PlaneResultFcn( b3ShapeId shapeId, const b3PlaneResult* plane, int planeCount, void* context );
1850
1853typedef bool b3MoverFilterFcn( b3ShapeId shapeId, void* context );
1854 // mover
1856
1864
1866typedef struct b3MassData
1867{
1869 float mass;
1870
1873
1876} b3MassData;
1877
1883
1885typedef struct b3Sphere
1886{
1889
1891 float radius;
1892} b3Sphere;
1893 // sphere
1895
1901
1904typedef struct b3Capsule
1905{
1908
1911
1913 float radius;
1914} b3Capsule;
1915 // capsule
1917
1923
1926typedef struct b3HullVertex
1927{
1931 uint8_t edge;
1932} b3HullVertex;
1933
1935typedef struct b3HullHalfEdge
1936{
1938 uint8_t next;
1939
1941 uint8_t twin;
1942
1944 uint8_t origin;
1945
1947 uint8_t face;
1949
1952typedef struct b3HullFace
1953{
1955 uint8_t edge;
1956} b3HullFace;
1957
1959#define B3_HULL_VERSION 0x9D4716CE3793900Eull
1960
1963typedef struct b3HullData
1964{
1966 uint64_t version;
1967
1970
1972 uint32_t hash;
1973
1976
1979
1981 float volume;
1982
1985
1988
1991
1994
1997
2000
2003
2006
2009
2012
2015
2019} b3HullData;
2020
2033 // hull
2035
2041
2043typedef struct b3MeshDef
2044{
2047
2049 int32_t* indices;
2050
2055
2058
2061
2064
2067
2071
2074} b3MeshDef;
2075
2077#define B3_MESH_VERSION 0xABD11AB62A6E886Dull
2078
2081{
2082 b3_concaveEdge1 = 0x01,
2083 b3_concaveEdge2 = 0x02,
2084 b3_concaveEdge3 = 0x04,
2085
2086 b3_inverseConcaveEdge1 = 0x10,
2087 b3_inverseConcaveEdge2 = 0x20,
2088 b3_inverseConcaveEdge3 = 0x40,
2089
2090 b3_allConcaveEdges = b3_concaveEdge1 | b3_concaveEdge2 | b3_concaveEdge3,
2091
2092 b3_flatEdge1 = b3_concaveEdge1 | b3_inverseConcaveEdge1,
2093 b3_flatEdge2 = b3_concaveEdge2 | b3_inverseConcaveEdge2,
2094 b3_flatEdge3 = b3_concaveEdge3 | b3_inverseConcaveEdge3,
2095
2096 b3_allFlatEdges = b3_flatEdge1 | b3_flatEdge2 | b3_flatEdge3,
2097
2099
2101typedef struct b3MeshTriangle
2102{
2103 int32_t index1;
2104 int32_t index2;
2105 int32_t index3;
2107
2109typedef struct b3MeshNode
2110{
2113
2115 union
2116 {
2118 struct
2119 {
2121 uint32_t axis : 2;
2123 uint32_t childOffset : 30;
2124 } asNode;
2125
2127 struct
2128 {
2130 uint32_t type : 2;
2131
2133 uint32_t triangleCount : 30;
2134 } asLeaf;
2136
2139
2142} b3MeshNode;
2143
2146typedef struct b3MeshData
2147{
2149 uint64_t version;
2150
2153
2155 uint32_t hash;
2156
2159
2162
2165
2168
2171
2174
2177
2180
2183
2186
2189
2192
2195} b3MeshData;
2196
2198typedef struct b3Mesh
2199{
2202
2206} b3Mesh;
2207 // mesh
2209
2215
2217typedef struct b3HeightFieldDef
2218{
2221 float* heights;
2222
2227
2230
2233
2236
2243
2246
2250
2252#define B3_HEIGHT_FIELD_HOLE 0xFF
2253
2255#define B3_HEIGHT_FIELD_VERSION 0x8B18CBD138A6BC84ull
2256
2259typedef struct b3HeightFieldData
2260{
2262 uint64_t version;
2263
2266
2268 uint32_t hash;
2269
2272
2275
2278
2281
2284
2287
2290
2294
2298
2302
2305
2308 uint8_t padding[3];
2310 // height_field
2312
2318
2328
2341
2361
2371
2400
2402#define B3_COMPOUND_VERSION ( 0x830778DB07086EB4ull ^ B3_DYNAMIC_TREE_VERSION ^ B3_MESH_VERSION ^ B3_HULL_VERSION )
2403
2406#define B3_MAX_COMPOUND_MESH_MATERIALS 4
2407
2413typedef struct b3CompoundData
2414{
2416 uint64_t version;
2417
2420
2423
2426
2429
2432
2435
2438
2441
2444
2447
2450
2453
2456
2459
2463
2473
2486
2505
2515
2538
2540typedef bool b3CompoundQueryFcn( const b3CompoundData* compound, int childIndex, void* context );
2541 // compound
2543 // geometry
2545
2551
2557typedef struct b3ManifoldPoint
2558{
2561
2564
2567
2570
2574
2578
2582
2585 uint32_t featureId;
2586
2589
2593
2596typedef struct b3Manifold
2597{
2599 b3ManifoldPoint points[B3_MAX_MANIFOLD_POINTS];
2600
2603
2606
2609
2612
2615
2616} b3Manifold;
2617
2619typedef enum
2620{
2621 b3_invalidAxis = 0,
2622 b3_backsideAxis,
2623 b3_faceAxisA,
2624 b3_faceAxisB,
2625 b3_edgePairAxis,
2626 b3_closestPointsAxis,
2627
2630 b3_manualFaceAxisB,
2631 b3_manualEdgePairAxis,
2633
2635typedef enum
2636{
2637 b3_featureNone = 0,
2638 b3_featureTriangleFace,
2639 b3_featureHullFace,
2646 b3_featureVertex1,
2647 b3_featureVertex2,
2648 b3_featureVertex3
2650
2652typedef struct
2653{
2656
2658 uint8_t type;
2659
2661 uint8_t indexA;
2662
2664 uint8_t indexB;
2665
2667 uint8_t hit;
2668} b3SATCache;
2669
2676typedef struct b3FeaturePair
2677{
2679 uint8_t owner1;
2681 uint8_t index1;
2683 uint8_t owner2;
2685 uint8_t index2;
2687
2703
2735 // collision
2737
2742
2747typedef enum b3HexColor
2748{
2749 b3_colorAliceBlue = 0xF0F8FF,
2750 b3_colorAntiqueWhite = 0xFAEBD7,
2751 b3_colorAqua = 0x00FFFF,
2752 b3_colorAquamarine = 0x7FFFD4,
2753 b3_colorAzure = 0xF0FFFF,
2754 b3_colorBeige = 0xF5F5DC,
2755 b3_colorBisque = 0xFFE4C4,
2756 b3_colorBlack = 0x000000,
2757 b3_colorBlanchedAlmond = 0xFFEBCD,
2758 b3_colorBlue = 0x0000FF,
2759 b3_colorBlueViolet = 0x8A2BE2,
2760 b3_colorBrown = 0xA52A2A,
2761 b3_colorBurlywood = 0xDEB887,
2762 b3_colorCadetBlue = 0x5F9EA0,
2763 b3_colorChartreuse = 0x7FFF00,
2764 b3_colorChocolate = 0xD2691E,
2765 b3_colorCoral = 0xFF7F50,
2766 b3_colorCornflowerBlue = 0x6495ED,
2767 b3_colorCornsilk = 0xFFF8DC,
2768 b3_colorCrimson = 0xDC143C,
2769 b3_colorCyan = 0x00FFFF,
2770 b3_colorDarkBlue = 0x00008B,
2771 b3_colorDarkCyan = 0x008B8B,
2772 b3_colorDarkGoldenRod = 0xB8860B,
2773 b3_colorDarkGray = 0xA9A9A9,
2774 b3_colorDarkGreen = 0x006400,
2775 b3_colorDarkKhaki = 0xBDB76B,
2776 b3_colorDarkMagenta = 0x8B008B,
2777 b3_colorDarkOliveGreen = 0x556B2F,
2778 b3_colorDarkOrange = 0xFF8C00,
2779 b3_colorDarkOrchid = 0x9932CC,
2780 b3_colorDarkRed = 0x8B0000,
2781 b3_colorDarkSalmon = 0xE9967A,
2782 b3_colorDarkSeaGreen = 0x8FBC8F,
2783 b3_colorDarkSlateBlue = 0x483D8B,
2784 b3_colorDarkSlateGray = 0x2F4F4F,
2785 b3_colorDarkTurquoise = 0x00CED1,
2786 b3_colorDarkViolet = 0x9400D3,
2787 b3_colorDeepPink = 0xFF1493,
2788 b3_colorDeepSkyBlue = 0x00BFFF,
2789 b3_colorDimGray = 0x696969,
2790 b3_colorDodgerBlue = 0x1E90FF,
2791 b3_colorFireBrick = 0xB22222,
2792 b3_colorFloralWhite = 0xFFFAF0,
2793 b3_colorForestGreen = 0x228B22,
2794 b3_colorFuchsia = 0xFF00FF,
2795 b3_colorGainsboro = 0xDCDCDC,
2796 b3_colorGhostWhite = 0xF8F8FF,
2797 b3_colorGold = 0xFFD700,
2798 b3_colorGoldenRod = 0xDAA520,
2799 b3_colorGray = 0x808080,
2800 b3_colorGreen = 0x008000,
2801 b3_colorGreenYellow = 0xADFF2F,
2802 b3_colorHoneyDew = 0xF0FFF0,
2803 b3_colorHotPink = 0xFF69B4,
2804 b3_colorIndianRed = 0xCD5C5C,
2805 b3_colorIndigo = 0x4B0082,
2806 b3_colorIvory = 0xFFFFF0,
2807 b3_colorKhaki = 0xF0E68C,
2808 b3_colorLavender = 0xE6E6FA,
2809 b3_colorLavenderBlush = 0xFFF0F5,
2810 b3_colorLawnGreen = 0x7CFC00,
2811 b3_colorLemonChiffon = 0xFFFACD,
2812 b3_colorLightBlue = 0xADD8E6,
2813 b3_colorLightCoral = 0xF08080,
2814 b3_colorLightCyan = 0xE0FFFF,
2815 b3_colorLightGoldenRodYellow = 0xFAFAD2,
2816 b3_colorLightGray = 0xD3D3D3,
2817 b3_colorLightGreen = 0x90EE90,
2818 b3_colorLightPink = 0xFFB6C1,
2819 b3_colorLightSalmon = 0xFFA07A,
2820 b3_colorLightSeaGreen = 0x20B2AA,
2821 b3_colorLightSkyBlue = 0x87CEFA,
2822 b3_colorLightSlateGray = 0x778899,
2823 b3_colorLightSteelBlue = 0xB0C4DE,
2824 b3_colorLightYellow = 0xFFFFE0,
2825 b3_colorLime = 0x00FF00,
2826 b3_colorLimeGreen = 0x32CD32,
2827 b3_colorLinen = 0xFAF0E6,
2828 b3_colorMagenta = 0xFF00FF,
2829 b3_colorMaroon = 0x800000,
2830 b3_colorMediumAquaMarine = 0x66CDAA,
2831 b3_colorMediumBlue = 0x0000CD,
2832 b3_colorMediumOrchid = 0xBA55D3,
2833 b3_colorMediumPurple = 0x9370DB,
2834 b3_colorMediumSeaGreen = 0x3CB371,
2835 b3_colorMediumSlateBlue = 0x7B68EE,
2836 b3_colorMediumSpringGreen = 0x00FA9A,
2837 b3_colorMediumTurquoise = 0x48D1CC,
2838 b3_colorMediumVioletRed = 0xC71585,
2839 b3_colorMidnightBlue = 0x191970,
2840 b3_colorMintCream = 0xF5FFFA,
2841 b3_colorMistyRose = 0xFFE4E1,
2842 b3_colorMoccasin = 0xFFE4B5,
2843 b3_colorNavajoWhite = 0xFFDEAD,
2844 b3_colorNavy = 0x000080,
2845 b3_colorOldLace = 0xFDF5E6,
2846 b3_colorOlive = 0x808000,
2847 b3_colorOliveDrab = 0x6B8E23,
2848 b3_colorOrange = 0xFFA500,
2849 b3_colorOrangeRed = 0xFF4500,
2850 b3_colorOrchid = 0xDA70D6,
2851 b3_colorPaleGoldenRod = 0xEEE8AA,
2852 b3_colorPaleGreen = 0x98FB98,
2853 b3_colorPaleTurquoise = 0xAFEEEE,
2854 b3_colorPaleVioletRed = 0xDB7093,
2855 b3_colorPapayaWhip = 0xFFEFD5,
2856 b3_colorPeachPuff = 0xFFDAB9,
2857 b3_colorPeru = 0xCD853F,
2858 b3_colorPink = 0xFFC0CB,
2859 b3_colorPlum = 0xDDA0DD,
2860 b3_colorPowderBlue = 0xB0E0E6,
2861 b3_colorPurple = 0x800080,
2862 b3_colorRebeccaPurple = 0x663399,
2863 b3_colorRed = 0xFF0000,
2864 b3_colorRosyBrown = 0xBC8F8F,
2865 b3_colorRoyalBlue = 0x4169E1,
2866 b3_colorSaddleBrown = 0x8B4513,
2867 b3_colorSalmon = 0xFA8072,
2868 b3_colorSandyBrown = 0xF4A460,
2869 b3_colorSeaGreen = 0x2E8B57,
2870 b3_colorSeaShell = 0xFFF5EE,
2871 b3_colorSienna = 0xA0522D,
2872 b3_colorSilver = 0xC0C0C0,
2873 b3_colorSkyBlue = 0x87CEEB,
2874 b3_colorSlateBlue = 0x6A5ACD,
2875 b3_colorSlateGray = 0x708090,
2876 b3_colorSnow = 0xFFFAFA,
2877 b3_colorSpringGreen = 0x00FF7F,
2878 b3_colorSteelBlue = 0x4682B4,
2879 b3_colorTan = 0xD2B48C,
2880 b3_colorTeal = 0x008080,
2881 b3_colorThistle = 0xD8BFD8,
2882 b3_colorTomato = 0xFF6347,
2883 b3_colorTurquoise = 0x40E0D0,
2884 b3_colorViolet = 0xEE82EE,
2885 b3_colorWheat = 0xF5DEB3,
2886 b3_colorWhite = 0xFFFFFF,
2887 b3_colorWhiteSmoke = 0xF5F5F5,
2888 b3_colorYellow = 0xFFFF00,
2889 b3_colorYellowGreen = 0x9ACD32,
2890
2891 b3_colorBox2DRed = 0xDC3132,
2892 b3_colorBox2DBlue = 0x30AEBF,
2893 b3_colorBox2DGreen = 0x8CC924,
2894 b3_colorBox2DYellow = 0xFFEE8C
2895} b3HexColor;
2896
2902{
2903 b3_debugMaterialDefault = 0,
2904 b3_debugMaterialMatte,
2905 b3_debugMaterialSoft,
2906 b3_debugMaterialDead,
2907 b3_debugMaterialGlossy,
2908 b3_debugMaterialMetallic
2910
2913B3_INLINE uint32_t b3MakeDebugColor( b3HexColor rgb, b3DebugMaterial material )
2914{
2915 return ( (uint32_t)rgb & 0x00FFFFFFu ) | ( (uint32_t)material << 24 );
2916}
2917
2920B3_API b3HexColor b3GetGraphColor( int index );
2921
2924typedef struct b3DebugShape
2925{
2928
2931
2933 union
2934 {
2935 const b3Capsule* capsule;
2936 const b3CompoundData* compound;
2938 const b3HullData* hull;
2939 const b3Mesh* mesh;
2940 const b3Sphere* sphere;
2941 };
2942} b3DebugShape;
2943
2947typedef struct b3DebugDraw
2948{
2950 bool ( *DrawShapeFcn )( void* userShape, b3WorldTransform transform, b3HexColor color, void* context );
2951
2953 void ( *DrawSegmentFcn )( b3Pos p1, b3Pos p2, b3HexColor color, void* context );
2954
2956 void ( *DrawTransformFcn )( b3WorldTransform transform, void* context );
2957
2959 void ( *DrawPointFcn )( b3Pos p, float size, b3HexColor color, void* context );
2960
2962 void ( *DrawSphereFcn )( b3Pos p, float radius, b3HexColor color, float alpha, void* context );
2963
2965 void ( *DrawCapsuleFcn )( b3Pos p1, b3Pos p2, float radius, b3HexColor color, float alpha, void* context );
2966
2968 void ( *DrawBoundsFcn )( b3AABB aabb, b3HexColor color, void* context );
2969
2971 void ( *DrawBoxFcn )( b3Vec3 extents, b3WorldTransform transform, b3HexColor color, void* context );
2972
2974 void ( *DrawStringFcn )( b3Pos p, const char* s, b3HexColor color, void* context );
2975
2978
2981
2984
2987
2990
2993
2996
2999
3002
3005
3008
3011
3014
3017
3020
3023
3026
3028 void* context;
3029} b3DebugDraw;
3030
3033 // debug_draw
bool isAwake
Is this body initially awake or sleeping?
Definition types.h:318
const char * name
Optional body name for debugging. Up to B3_BODY_NAME_LENGTH characters (including null termination).
Definition types.h:306
float gravityScale
Scale the gravity applied to this body. Non-dimensional.
Definition types.h:300
b3BodyType type
The body type: static, kinematic, or dynamic.
Definition types.h:270
void * userData
Use this to store application specific body data.
Definition types.h:309
float linearDamping
Linear damping is used to reduce the linear velocity.
Definition types.h:291
bool enableSleep
Set this flag to false if this body should never fall asleep.
Definition types.h:315
int internalValue
Used internally to detect a valid definition. DO NOT SET.
Definition types.h:348
bool angularX
Prevent rotation around the x-axis.
Definition types.h:253
bool linearZ
Prevent translation along the z-axis.
Definition types.h:250
bool angularY
Prevent rotation around the y-axis.
Definition types.h:256
bool angularZ
Prevent rotation around the z-axis.
Definition types.h:259
bool isBullet
Treat this body as a high speed object that performs continuous collision detection against dynamic a...
Definition types.h:334
b3Pos position
The initial world position of the body.
Definition types.h:275
bool allowFastRotation
This allows this body to bypass rotational speed limits.
Definition types.h:341
float sleepThreshold
Sleep speed threshold, default is 0.05 meters per second.
Definition types.h:303
b3Vec3 angularVelocity
The initial angular velocity of the body. Radians per second.
Definition types.h:284
bool isEnabled
Used to disable a body. A disabled body does not move or collide.
Definition types.h:337
b3MotionLocks motionLocks
Motions locks to restrict linear and angular movement.
Definition types.h:312
bool linearX
Prevent translation along the x-axis.
Definition types.h:244
float angularDamping
Angular damping is used to reduce the angular velocity.
Definition types.h:297
b3Vec3 linearVelocity
The initial linear velocity of the body's origin. Usually in meters per second.
Definition types.h:281
bool enableContactRecycling
Enable contact recycling.
Definition types.h:345
bool linearY
Prevent translation along the y-axis.
Definition types.h:247
b3Quat rotation
The initial world rotation of the body.
Definition types.h:278
b3BodyType
The body simulation type.
Definition types.h:225
b3BodyDef b3DefaultBodyDef(void)
Use this to initialize your body definition.
@ b3_staticBody
zero mass, zero velocity, may be manually moved
Definition types.h:227
@ b3_bodyTypeCount
number of body types
Definition types.h:236
@ b3_dynamicBody
positive mass, velocity determined by forces, moved by solver
Definition types.h:233
@ b3_kinematicBody
zero mass, velocity set by user, moved by solver
Definition types.h:230
A body definition holds all the data needed to construct a rigid body.
Definition types.h:268
Motion locks to restrict the body movement.
Definition types.h:242
float radius
The radius of the hemispheres.
Definition types.h:1913
b3Vec3 center1
Local center of the first hemisphere.
Definition types.h:1907
b3Vec3 center2
Local center of the second hemisphere.
Definition types.h:1910
A solid capsule can be viewed as two hemispheres connected by a rectangle.
Definition types.h:1905
b3ShapeId shapeId
The shape id on the body.
Definition types.h:1841
b3Plane plane
Outward pointing plane.
Definition types.h:1802
float pushLimit
Setting this to FLT_MAX makes the plane as rigid as possible.
Definition types.h:1818
bool clipVelocity
Indicates if b3ClipVector should clip against this plane. Should be false for soft collision.
Definition types.h:1824
b3Plane plane
The collision plane between the mover and some shape.
Definition types.h:1814
b3PlaneResult result
The plane result.
Definition types.h:1844
float push
The push on the mover determined by b3SolvePlanes. Usually in meters.
Definition types.h:1821
b3Vec3 delta
The final relative translation.
Definition types.h:1831
b3Vec3 point
Closest point on the shape. May not be unique.
Definition types.h:1805
int iterationCount
The number of iterations used by the plane solver. For diagnostics.
Definition types.h:1834
bool b3MoverFilterFcn(b3ShapeId shapeId, void *context)
Used to filter shapes for shape casting character movers.
Definition types.h:1853
bool b3PlaneResultFcn(b3ShapeId shapeId, const b3PlaneResult *plane, int planeCount, void *context)
Used to collect collision planes for character movers.
Definition types.h:1849
Body plane result for movers.
Definition types.h:1839
These are collision planes that can be fed to b3SolvePlanes.
Definition types.h:1812
The plane between a character mover and a shape.
Definition types.h:1800
Result returned by b3SolvePlanes.
Definition types.h:1829
b3Vec3 anchorB
Location of the contact point relative to the bodyB center of mass in world space.
Definition types.h:2563
int triangleFlags
b3MeshEdgeFlags.
Definition types.h:2733
uint8_t indexB
Index of the feature on shape B.
Definition types.h:2664
uint8_t indexA
Index of the feature on shape A.
Definition types.h:2661
float baseSeparation
Cached separation used for contact recycling.
Definition types.h:2569
b3Vec3 normal
Local normal in frame A.
Definition types.h:2708
b3Vec3 rollingImpulse
Rolling resistance angular impulse.
Definition types.h:2611
b3FeaturePair pair
The feature pair for this point.
Definition types.h:2698
b3Vec3 anchorA
Location of the contact point relative to the bodyA center of mass in world space.
Definition types.h:2560
int i1
Vertex 1 index.
Definition types.h:2722
b3ManifoldPoint points[B3_MAX_MANIFOLD_POINTS]
The manifold points. There may be 1 to 4 valid points.
Definition types.h:2599
float squaredDistance
The squared distance of a sphere from a triangle. For ghost collision reduction.
Definition types.h:2727
int pointCount
The number of manifold points. Only bounded by the buffer capacity.
Definition types.h:2717
float normalImpulse
The impulse along the manifold normal vector.
Definition types.h:2573
uint8_t owner2
Outgoing type (either edge on shape A or shape B).
Definition types.h:2683
float totalNormalImpulse
The total normal impulse applied during sub-stepping.
Definition types.h:2577
b3TriangleFeature feature
The triangle feature involved.
Definition types.h:2730
int triangleIndex
Triangle index if one of the shapes is a mesh or height field.
Definition types.h:2588
float separation
The contact point separation. Negative for overlap.
Definition types.h:2695
uint32_t featureId
Local point for matching Uniquely identifies a contact point between two shapes.
Definition types.h:2585
b3Vec3 triangleNormal
The triangle normal.
Definition types.h:2711
uint8_t type
b3SeparatingFeature.
Definition types.h:2658
uint8_t hit
Was the cache re-used?
Definition types.h:2667
b3Vec3 point
Local point in frame A.
Definition types.h:2692
float separation
The separation of the contact point, negative if penetrating.
Definition types.h:2566
int i3
Vertex 3 index.
Definition types.h:2724
uint8_t owner1
Incoming type (either edge on shape A or shape B).
Definition types.h:2679
float twistImpulse
Central friction angular impulse (applied about the normal).
Definition types.h:2605
int triangleIndex
The triangle index when collide with a mesh or height-field.
Definition types.h:2701
b3Vec3 frictionImpulse
Central friction linear impulse.
Definition types.h:2608
int i2
Vertex 2 index.
Definition types.h:2723
int triangleIndex
The index of the triangle.
Definition types.h:2720
int pointCount
The number of contact points, will be 0 to 4.
Definition types.h:2614
uint8_t index2
Outgoing edge index (into associated shape array).
Definition types.h:2685
b3LocalManifoldPoint * points
The manifold points. From a point buffer.
Definition types.h:2714
bool persisted
Did this contact point exist in the previous step?
Definition types.h:2591
float separation
The separation when the cache is populated. Negative for overlap.
Definition types.h:2655
b3Vec3 normal
The unit normal vector in world space, points from shape A to shape B.
Definition types.h:2602
float normalVelocity
Relative normal velocity pre-solve.
Definition types.h:2581
uint8_t index1
Incoming edge index (into associated shape array).
Definition types.h:2681
b3SeparatingFeature
Cached separating axis feature.
Definition types.h:2620
b3TriangleFeature
Cached triangle feature.
Definition types.h:2636
@ b3_manualFaceAxisA
These are for testing.
Definition types.h:2629
@ b3_featureEdge3
v3-v1
Definition types.h:2645
@ b3_featureEdge1
v1-v2
Definition types.h:2641
@ b3_featureEdge2
v2-v3
Definition types.h:2643
Contact points are always the result of two edges intersecting.
Definition types.h:2677
A local manifold with no dynamic information. Used by b3Collide functions.
Definition types.h:2706
A local manifold point and normal in frame A.
Definition types.h:2690
A contact manifold describes the contact points between colliding shapes.
Definition types.h:2597
A manifold point is a contact point belonging to a contact manifold.
Definition types.h:2558
Separating axis test cache. Provides temporal acceleration of collision routines.
Definition types.h:2653
int hullCount
The number of hull instances.
Definition types.h:2443
int sharedMeshCount
The number of unique meshes. Diagnostic.
Definition types.h:2455
b3SurfaceMaterial material
Material properties.
Definition types.h:2369
b3CompoundSphereDef * spheres
Sphere instances.
Definition types.h:2395
b3Transform transform
The transform of this mesh instance.
Definition types.h:2494
const b3HullData * hull
Hull.
int materialOffset
Offset of the material array in bytes from the struct address.
Definition types.h:2428
uint64_t version
The compound version is always first.
Definition types.h:2416
int materialCount
The number of materials.
Definition types.h:2431
b3Capsule capsule
Capsule.
b3Sphere sphere
Sphere.
b3DynamicTree tree
Immutable dynamic tree. The tree node pointer must be fixed up using the node offset.
Definition types.h:2425
b3Vec3 scale
Local space non-uniform mesh scale. May have negative components.
Definition types.h:2352
int meshCount
Number of mesh instances.
Definition types.h:2392
int sharedHullCount
The number of unique hulls. Diagnostic.
Definition types.h:2446
b3SurfaceMaterial material
Material properties.
Definition types.h:2326
int capsuleCount
Number of capsules.
Definition types.h:2380
b3Transform transform
The transform of this hull instance.
Definition types.h:2481
const b3MeshData * meshData
Shared mesh.
Definition types.h:2346
int sphereCount
Number of spheres.
Definition types.h:2398
b3Transform transform
Transform of the shared mesh into compound local space.
Definition types.h:2349
b3Capsule capsule
Local capsule.
Definition types.h:2468
int sphereOffset
Offset of the sphere array in bytes from the struct address.
Definition types.h:2458
b3Vec3 scale
Non-uniform scale of this mesh instance.
Definition types.h:2497
b3Transform transform
Transform of the shared hull into compound local space.
Definition types.h:2336
b3SurfaceMaterial material
Material properties.
Definition types.h:2339
b3Capsule capsule
Local capsule.
Definition types.h:2323
int meshCount
The number of mesh instances.
Definition types.h:2452
int materialCount
Number of materials.
Definition types.h:2359
b3Sphere sphere
Local sphere.
Definition types.h:2366
int hullOffset
Offset of the hull instance array in bytes from the struct address.
Definition types.h:2440
int materialIndex
Index to a shared material.
Definition types.h:2513
const b3MeshData * meshData
Pointer to the unique shared mesh.
Definition types.h:2491
int capsuleOffset
Offset of the capsule array in bytes from the struct address.
Definition types.h:2434
b3CompoundCapsuleDef * capsules
Capsule instances.
Definition types.h:2377
int byteCount
The total number of bytes for this compound.
Definition types.h:2419
const b3HullData * hull
Shared hull.
Definition types.h:2333
int sphereCount
The number of spheres.
Definition types.h:2461
b3Sphere sphere
Local sphere.
Definition types.h:2510
int meshOffset
Offset of the mesh instance array in bytes from the struct address.
Definition types.h:2449
int capsuleCount
The number of capsules.
Definition types.h:2437
b3CompoundHullDef * hulls
Hulls instances.
Definition types.h:2383
int nodeOffset
Offset of the tree node array in bytes from the struct address.
Definition types.h:2422
int materialIndex
Index to a shared material.
Definition types.h:2471
b3CompoundMeshDef * meshes
Mesh instances.
Definition types.h:2389
const b3HullData * hull
Pointer to the unique shared hull.
Definition types.h:2478
int materialIndices[B3_MAX_COMPOUND_MESH_MATERIALS]
This is used to access the surface material from b3GetCompoundMaterials.
Definition types.h:2503
int materialIndex
Index to a shared material.
Definition types.h:2484
const b3SurfaceMaterial * materials
Material properties.
Definition types.h:2356
int hullCount
Number of hull instances.
Definition types.h:2386
bool b3CompoundQueryFcn(const b3CompoundData *compound, int childIndex, void *context)
Callback for compound overlap queries.
Definition types.h:2540
#define B3_MAX_COMPOUND_MESH_MATERIALS
Meshes used in compounds have limited space for materials.
Definition types.h:2406
A capsule that lives in a compound.
Definition types.h:2466
Definition for a capsule in a compound shape.
Definition types.h:2321
The runtime data for a compound shape.
Definition types.h:2414
Definition for creating a compound shape.
Definition types.h:2375
A hull that lives in a compound.
Definition types.h:2476
Definition for a convex hull in a compound shape.
Definition types.h:2331
A mesh with non-uniform scale that lives in a compound.
Definition types.h:2489
Definition for a triangle mesh in a compound shape.
Definition types.h:2344
A sphere that lives in a compound.
Definition types.h:2508
Definition for a sphere in a compound shape.
Definition types.h:2364
const b3Mesh * mesh
Mesh shape with scale.
const b3HullData * hull
Convex hull shape.
const b3Capsule * capsule
Capsule shape.
const b3Sphere * sphere
Sphere shape.
const b3HeightFieldData * heightField
Height-field shape.
const b3CompoundData * compound
Compound shape.
uint32_t b3MakeDebugColor(b3HexColor rgb, b3DebugMaterial material)
Pack an RGB color with a material preset for debug draw.
Definition types.h:2913
void * b3CreateDebugShapeCallback(const b3DebugShape *debugShape, void *userContext)
The user needs to be able to create debug draw shapes for multi-pass rendering to work efficiently.
Definition types.h:47
b3DebugMaterial
Debug draw material preset.
Definition types.h:2902
b3DebugDraw b3DefaultDebugDraw(void)
Create a debug draw struct with default values.
b3HexColor b3GetGraphColor(int index)
Get the visualization color assigned to a constraint graph color slot.
b3HexColor
These colors are used for debug draw and mostly match the named SVG colors.
Definition types.h:2748
float maxLength
Maximum length. Must be greater than or equal to the minimum length.
Definition types.h:678
float lowerSpringForce
The lower spring force controls how much tension it can sustain.
Definition types.h:660
bool enableSpring
Enable the distance constraint to behave like a spring.
Definition types.h:657
float dampingRatio
The spring linear damping ratio, non-dimensional.
Definition types.h:669
bool enableLimit
Enable/disable the joint limit.
Definition types.h:672
b3JointDef base
Base joint definition.
Definition types.h:650
bool enableMotor
Enable/disable the joint motor.
Definition types.h:681
float maxMotorForce
The maximum motor force, usually in newtons.
Definition types.h:684
float upperSpringForce
The upper spring force controls how much compression it can sustain.
Definition types.h:663
float hertz
The spring linear stiffness Hertz, cycles per second.
Definition types.h:666
float minLength
Minimum length. Clamped to a stable minimum value.
Definition types.h:675
float length
The rest length of this joint. Clamped to a stable minimum value.
Definition types.h:653
float motorSpeed
The desired motor speed, usually in meters per second.
Definition types.h:687
b3DistanceJointDef b3DefaultDistanceJointDef(void)
Use this to initialize your joint definition.
Distance joint definition.
Definition types.h:648
b3ShapeId visitorShapeId
The id of the shape that stopped touching the sensor shape.
Definition types.h:1072
b3JointEvent * jointEvents
Array of events.
Definition types.h:1241
b3ContactId contactId
The contact id.
Definition types.h:1254
b3ContactBeginTouchEvent * beginEvents
Array of begin touch events.
Definition types.h:1169
uint64_t userMaterialIdA
User material on shape A.
Definition types.h:1156
b3ContactId contactId
Id of the contact.
Definition types.h:1126
int hitCount
Number of hit events.
Definition types.h:1184
b3BodyId bodyId
The body id.
Definition types.h:1206
b3Vec3 normal
Normal vector pointing from shape A to shape B.
Definition types.h:1150
int beginCount
The number of begin touch events.
Definition types.h:1087
b3ShapeId shapeIdA
Id of the first shape.
Definition types.h:1134
b3BodyMoveEvent * moveEvents
Array of move events.
Definition types.h:1218
float approachSpeed
The speed the shapes are approaching. Always positive. Typically in meters per second.
Definition types.h:1153
b3ShapeId shapeIdA
Id of the first shape.
Definition types.h:1116
int endCount
Number of end touch events.
Definition types.h:1181
uint64_t userMaterialIdB
User material on shape B.
Definition types.h:1159
b3ShapeId shapeIdB
Id of the second shape.
Definition types.h:1100
int moveCount
Number of move events.
Definition types.h:1221
b3ContactId contactId
The transient contact id.
Definition types.h:1104
int count
Number of events.
Definition types.h:1244
int manifoldCount
The number of contact manifolds. For mesh and height-field collision there can be multiple manifolds.
Definition types.h:1267
int endCount
The number of end touch events.
Definition types.h:1090
b3ContactId contactId
Id of the contact.
Definition types.h:1142
b3Pos point
Point where the shapes hit at the beginning of the time step.
Definition types.h:1147
b3ShapeId sensorShapeId
The id of the sensor shape.
Definition types.h:1052
b3ShapeId shapeIdB
The second shape id.
Definition types.h:1260
b3SensorBeginTouchEvent * beginEvents
Array of sensor begin touch events.
Definition types.h:1081
void * userData
The body user data.
Definition types.h:1200
bool fellAsleep
Did the body fall asleep this time step?
Definition types.h:1209
b3ShapeId shapeIdA
The first shape id.
Definition types.h:1257
b3ShapeId shapeIdB
Id of the first shape.
Definition types.h:1121
b3SensorEndTouchEvent * endEvents
Array of sensor end touch events.
Definition types.h:1084
void * userData
The user data from the joint for convenience.
Definition types.h:1232
b3ShapeId shapeIdA
Id of the first shape.
Definition types.h:1097
b3ShapeId visitorShapeId
The id of the shape that began touching the sensor shape.
Definition types.h:1055
b3ShapeId shapeIdB
Id of the second shape.
Definition types.h:1137
b3ContactEndTouchEvent * endEvents
Array of end touch events.
Definition types.h:1172
b3WorldTransform transform
The body transform.
Definition types.h:1203
b3ContactHitEvent * hitEvents
Array of hit events.
Definition types.h:1175
b3ShapeId sensorShapeId
The id of the sensor shape.
Definition types.h:1067
const struct b3Manifold * manifolds
The contact manifold.
Definition types.h:1264
int beginCount
Number of begin touch events.
Definition types.h:1178
b3JointId jointId
The joint id.
Definition types.h:1229
Body events are buffered in the world and are available as event arrays after the time step is comple...
Definition types.h:1216
Body move events triggered when a body moves.
Definition types.h:1198
A begin-touch event is generated when two shapes begin touching.
Definition types.h:1095
The contact data for two shapes.
Definition types.h:1251
An end touch event is generated when two shapes stop touching.
Definition types.h:1112
Contact events are buffered in the world and are available as event arrays after the time step is com...
Definition types.h:1167
A hit touch event is generated when two shapes collide with a speed faster than the hit speed thresho...
Definition types.h:1132
Joint events report joints that are awake and have a force and/or torque exceeding the threshold The ...
Definition types.h:1227
Joint events are buffered in the world and are available as event arrays after the time step is compl...
Definition types.h:1239
A begin-touch event is generated when a shape starts to overlap a sensor shape.
Definition types.h:1050
An end touch event is generated when a shape stops overlapping a sensor shape.
Definition types.h:1063
Sensor events are buffered in the world and are available as begin/end overlap event arrays after the...
Definition types.h:1079
b3JointDef base
Base joint definition.
Definition types.h:741
b3FilterJointDef b3DefaultFilterJointDef(void)
Use this to initialize your joint definition.
A filter joint is used to disable collision between two specific bodies.
Definition types.h:739
float mass
The shape mass.
Definition types.h:1869
b3Matrix3 inertia
The inertia tensor about the shape center of mass.
Definition types.h:1875
b3Vec3 center
The local center of mass position.
Definition types.h:1872
This holds the mass data computed for a shape.
Definition types.h:1867
bool clockwiseWinding
Use clock-wise winding. This effectively inverts the height-field along the y-axis.
Definition types.h:2248
int countZ
The number of grid lines along the z-axis.
Definition types.h:2235
int columnCount
The number of grid columns along the local x-axis.
Definition types.h:2286
float globalMinimumHeight
Global minimum and maximum heights used for quantization.
Definition types.h:2242
b3Vec3 scale
The height field scale. All components must be positive values.
Definition types.h:2229
int countX
The number of grid lines along the x-axis.
Definition types.h:2232
b3AABB aabb
The local axis-aligned bounding box.
Definition types.h:2271
bool clockwise
Triangle winding.
Definition types.h:2304
int flagsOffset
Offset of the flag array in bytes from the struct address.
Definition types.h:2301
float heightScale
The quantization scale.
Definition types.h:2280
int heightsOffset
Offset of the compressed height array in bytes from the struct address.
Definition types.h:2293
int byteCount
The total number of bytes for this height field.
Definition types.h:2265
uint8_t padding[3]
Explicit padding.
Definition types.h:2308
int rowCount
The number of grid rows along the local z-axis.
Definition types.h:2289
int materialOffset
Offset of the material index array in bytes from the struct address.
Definition types.h:2297
b3Vec3 scale
The overall scale.
Definition types.h:2283
float minHeight
The minimum y value.
Definition types.h:2274
float maxHeight
The maximum y value.
Definition types.h:2277
float * heights
Grid point heights count = countX * countZ.
Definition types.h:2221
uint8_t * materialIndices
Grid cell material A value of 0xFF is reserved for holes count = (countX - 1) * (countZ - 1).
Definition types.h:2226
float globalMaximumHeight
The maximum.
Definition types.h:2245
uint32_t hash
Hash of this height field (this field is zero when the hash is computed).
Definition types.h:2268
uint64_t version
Version must be first and match B3_HEIGHT_FIELD_VERSION.
Definition types.h:2262
A height field with compressed storage.
Definition types.h:2260
Data used to create a height field.
Definition types.h:2218
int planeOffset
Offset of the face plane array in bytes from the struct address.
Definition types.h:2014
int padding
Explicit padding.
Definition types.h:2018
b3AABB aabb
Axis-aligned box in local space.
Definition types.h:1975
int pointOffset
Offset of the point array in bytes from the struct address.
Definition types.h:1999
float innerRadius
The radius of the largest sphere at the center.
Definition types.h:1984
b3HullFace boxFaces[6]
Box faces.
Definition types.h:2029
int faceOffset
Offset of the face array in bytes from the struct address.
Definition types.h:2011
uint8_t edge
An arbitrary half-edge on this face.
Definition types.h:1955
b3Vec3 boxPoints[8]
Box points.
Definition types.h:2027
float volume
Volume, typically in m^3.
Definition types.h:1981
b3HullHalfEdge boxEdges[24]
Box half-edges.
Definition types.h:2028
int faceCount
The face count. Hulls faces are convex polygons.
Definition types.h:2008
int edgeCount
This is the half-edge count (double the edge count).
Definition types.h:2002
float surfaceArea
Surface area, typically in squared meters.
Definition types.h:1978
uint64_t version
Version must be first and match B3_HULL_VERSION.
Definition types.h:1966
b3Vec3 center
The local centroid.
Definition types.h:1987
uint8_t edge
A half-edge that has this vertex as the origin Can be used along with edge twins and winding order to...
Definition types.h:1931
uint8_t next
Next edge index CCW.
Definition types.h:1938
uint32_t hash
Hash of this hull (this field is zero when the hash is computed).
Definition types.h:1972
b3Plane boxPlanes[6]
Box face planes.
Definition types.h:2031
int vertexOffset
Offset of the vertex array in bytes from the struct address.
Definition types.h:1996
uint8_t padding[2]
Explicit padding, see b3HullData::padding.
Definition types.h:2030
b3HullVertex boxVertices[8]
Box vertices.
Definition types.h:2026
uint8_t twin
Twin edge index.
Definition types.h:1941
int byteCount
The total number of bytes for this hull.
Definition types.h:1969
b3HullData base
The embedded hull. So the offsets index into the arrays that follow.
Definition types.h:2025
uint8_t face
Face to the left of this edge.
Definition types.h:1947
b3Matrix3 centralInertia
The inertia tensor about the centroid.
Definition types.h:1990
uint8_t origin
index of origin vertex and point
Definition types.h:1944
int vertexCount
The vertex count.
Definition types.h:1993
int edgeOffset
Offset of the edge array in bytes from the struct address.
Definition types.h:2005
Efficient box hull.
Definition types.h:2023
A convex hull.
Definition types.h:1964
A hull face.
Definition types.h:1953
Half-edge for hull data structure.
Definition types.h:1936
A hull vertex.
Definition types.h:1927
Body id references a body instance. This should be treated as an opaque handle.
Definition id.h:45
Contact id references a contact instance. This should be treated as an opaque handle.
Definition id.h:69
Joint id references a joint instance. This should be treated as an opaque handle.
Definition id.h:61
Shape id references a shape instance. This should be treated as an opaque handle.
Definition id.h:53
int internalValue
Used internally to detect a valid definition. DO NOT SET.
Definition types.h:640
float drawScale
Debug draw scale.
Definition types.h:634
void * userData
User data pointer.
Definition types.h:607
b3Transform localFrameB
The second local joint frame.
Definition types.h:619
float constraintHertz
Constraint hertz (advanced feature).
Definition types.h:628
b3BodyId bodyIdA
The first attached body.
Definition types.h:610
b3Transform localFrameA
The first local joint frame.
Definition types.h:616
bool collideConnected
Set this flag to true if the attached bodies should collide.
Definition types.h:637
float forceThreshold
Force threshold for joint events.
Definition types.h:622
float constraintDampingRatio
Constraint damping ratio (advanced feature).
Definition types.h:631
b3BodyId bodyIdB
The second attached body.
Definition types.h:613
float torqueThreshold
Torque threshold for joint events.
Definition types.h:625
b3JointType
Joint type enumeration.
Definition types.h:587
Base joint definition used by all joint types.
Definition types.h:605
b3Vec3 b3Pos
In single precision mode these types are the same.
Definition math_functions.h:90
b3Transform b3WorldTransform
In single precision mode these types are the same.
Definition math_functions.h:93
Axis aligned bounding box.
Definition math_functions.h:105
A 3x3 matrix.
Definition math_functions.h:99
A plane.
Definition math_functions.h:113
A quaternion.
Definition math_functions.h:58
A rigid transform.
Definition math_functions.h:65
A 3D vector.
Definition math_functions.h:41
uint32_t triangleCount
The number of triangles for this leaf node.
int nodeCount
The number of BVH nodes.
Definition types.h:2173
int materialOffset
Offset of the material array in bytes from the struct address.
Definition types.h:2188
int treeHeight
The height of the bounding volume hierarchy.
Definition types.h:2164
int byteCount
The total number of bytes for this mesh.
Definition types.h:2152
int vertexOffset
Offset of the vertex array in bytes from the struct address.
Definition types.h:2176
int triangleCount
The number of triangles.
Definition types.h:2185
uint32_t axis
Split axis. 0, 1, or 2.
float surfaceArea
Combined surface area of all triangles. Single-sided.
Definition types.h:2161
const b3MeshData * data
Immutable pointer to the mesh data.
Definition types.h:2201
bool identifyEdges
Compute triangle adjacency information using shared edges.
Definition types.h:2073
uint32_t childOffset
Offset of the second child node.
uint8_t * materialIndices
Triangle material index.
Definition types.h:2054
uint32_t type
Aligned with axis above and has value of 3 if this is a leaf.
uint32_t hash
Hash of this mesh (this field is zero when the hash is computed).
Definition types.h:2155
b3Vec3 scale
This scale may be non-uniform and have negative components.
Definition types.h:2205
int32_t index3
Index of vertex 3.
Definition types.h:2105
int32_t index1
Index of vertex 1.
Definition types.h:2103
b3Vec3 * vertices
Triangle vertices.
Definition types.h:2046
bool useMedianSplit
Use the median split instead of SAH to speed up mesh creation.
Definition types.h:2070
int nodeOffset
Offset of the node array in bytes from the struct address.
Definition types.h:2170
int triangleCount
The triangle count. Must be 1 or more.
Definition types.h:2063
int flagsOffset
Offset of the triangle flag array in bytes from the struct address.
Definition types.h:2194
uint64_t version
Version must be first.
Definition types.h:2149
int vertexCount
The number of vertices.
Definition types.h:2179
b3AABB bounds
Local axis-aligned box.
Definition types.h:2158
int32_t * indices
Triangle vertex indices. 3 for each triangle.
Definition types.h:2049
int triangleOffset
Offset of the triangle array in bytes from the struct address.
Definition types.h:2182
bool weldVertices
Optionally weld nearby vertices.
Definition types.h:2066
float weldTolerance
Tolerance for vertex welding in length units.
Definition types.h:2057
int vertexCount
The vertex count. Must be 3 or more.
Definition types.h:2060
int materialCount
The number of materials.
Definition types.h:2191
int32_t index2
Index of vertex 2.
Definition types.h:2104
int degenerateCount
The number of degenerate triangles. Diagnostic.
Definition types.h:2167
b3MeshEdgeFlags
Triangle mesh edge flags.
Definition types.h:2081
This allows mesh data to be re-used with different scales.
Definition types.h:2199
This is a sorted triangle collision bounding volume hierarchy.
Definition types.h:2147
This is used to create a re-usable collision mesh.
Definition types.h:2044
A mesh triangle.
Definition types.h:2102
float maxSpringTorque
Maximum spring torque in newton-meters.
Definition types.h:729
float maxVelocityTorque
The maximum motor torque in newton-meters.
Definition types.h:711
float angularHertz
Angular spring hertz for position control.
Definition types.h:723
float linearHertz
Linear spring hertz for position control.
Definition types.h:714
float maxSpringForce
Maximum spring force in newtons.
Definition types.h:720
b3JointDef base
Base joint definition.
Definition types.h:699
b3Vec3 linearVelocity
The desired linear velocity.
Definition types.h:702
float linearDampingRatio
Linear spring damping ratio.
Definition types.h:717
float angularDampingRatio
Angular spring damping ratio.
Definition types.h:726
float maxVelocityForce
The maximum motor force in newtons.
Definition types.h:705
b3Vec3 angularVelocity
The desired angular velocity.
Definition types.h:708
b3MotorJointDef b3DefaultMotorJointDef(void)
Use this to initialize your joint definition.
A motor joint is used to control the relative position and velocity between two bodies.
Definition types.h:697
float hertz
The spring stiffness Hertz, cycles per second.
Definition types.h:757
float maxTorque
The maximum spring torque, typically in newton-meters.
Definition types.h:763
float dampingRatio
The spring damping ratio, non-dimensional.
Definition types.h:760
b3JointDef base
Base joint definition.
Definition types.h:754
b3ParallelJointDef b3DefaultParallelJointDef(void)
Use this to initialize your joint definition.
Parallel joint definition.
Definition types.h:752
bool enableLimit
Enable/disable the joint limit.
Definition types.h:794
float upperTranslation
The upper translation limit.
Definition types.h:800
float targetTranslation
The target translation for the joint in meters.
Definition types.h:791
b3JointDef base
Base joint definition.
Definition types.h:778
float maxMotorForce
The maximum motor force, typically in newtons.
Definition types.h:806
bool enableMotor
Enable/disable the joint motor.
Definition types.h:803
float lowerTranslation
The lower translation limit.
Definition types.h:797
bool enableSpring
Enable a linear spring along the prismatic joint axis.
Definition types.h:781
float dampingRatio
The spring damping ratio, non-dimensional.
Definition types.h:787
float hertz
The spring stiffness Hertz, cycles per second.
Definition types.h:784
float motorSpeed
The desired motor speed, typically in meters per second.
Definition types.h:809
b3PrismaticJointDef b3DefaultPrismaticJointDef(void)
Use this to initialize your joint definition.
Prismatic joint definition.
Definition types.h:776
b3Vec3 normal
A to B normal in shape A's frame. Invalid if distance is zero.
Definition types.h:1554
b3ShapeProxy proxyB
The proxy for shape B.
Definition types.h:1539
b3Vec3 c1
Starting center of mass world position.
Definition types.h:1584
int nodeVisits
The number of BVH nodes visited. Diagnostic.
Definition types.h:1347
int triangleIndex
The triangle index if the shape is a mesh, height-field, or compound with child mesh.
Definition types.h:1341
bool usedFallback
Indicates that the time of impact detected initial overlap and used a fallback sphere as a last ditch...
Definition types.h:1640
b3Vec3 w
wB - wA
Definition types.h:1565
b3Vec3 origin
Start point of the ray cast.
Definition types.h:1310
b3Vec3 point
The surface hit point.
Definition types.h:1409
b3Vec3 wB
support point in proxyB
Definition types.h:1564
b3Vec3 normal
The world normal vector on the shape surface.
Definition types.h:1478
b3Vec3 wA
support point in proxyA
Definition types.h:1563
float fraction
The sweep time of the collision.
Definition types.h:1623
int childIndex
The child index if the shape is a compound.
Definition types.h:1344
bool canEncroach
Allow shape cast to encroach when initially touching. This only works if the radius is greater than z...
Definition types.h:1384
int simplexCount
The number of simplexes stored in the simplex array.
Definition types.h:1557
float fraction
The fraction of the input ray.
Definition types.h:1337
b3Pos point
The world point on the shape surface.
Definition types.h:1475
float fraction
The fraction along the ray hit.
Definition types.h:1482
int triangleIndex
The index of the mesh or height field triangle hit.
Definition types.h:1418
b3Vec3 c2
Ending center of mass world position.
Definition types.h:1585
uint64_t userMaterialId
The user material id at the hit point.
Definition types.h:1489
b3Vec3 translation
The sweep translation.
Definition types.h:1396
uint8_t indexA[4]
The cached simplex indices on shape A.
Definition types.h:1512
b3ShapeProxy proxyB
The proxy for shape B.
Definition types.h:1525
bool hit
Did the cast hit? If false, all other fields are invalid.
Definition types.h:1495
float metric
Value use to compare length, area, volume of two simplexes.
Definition types.h:1505
b3Vec3 normal
The hit normal.
Definition types.h:1620
b3Vec3 pointB
Closest point on shapeB, in shape A's frame.
Definition types.h:1553
float radius
The external radius of the point cloud.
Definition types.h:1366
uint16_t count
The number of stored simplex points.
Definition types.h:1509
int count
number of valid vertices
Definition types.h:1575
bool hit
Did the ray hit? If false, all other data is invalid.
Definition types.h:1353
float distance
The final distance.
Definition types.h:1626
uint64_t maskBits
The collision mask bits.
Definition types.h:1290
float maxFraction
The maximum fraction of the translation to consider, typically 1.
Definition types.h:1381
const char * name
Optional label combined with Ids to identify this query, e.g.
Definition types.h:1300
b3Transform transform
Transform of shape B in shape A's frame, the relative pose B in A.
Definition types.h:1526
b3ShapeProxy proxyA
The proxy for shape A.
Definition types.h:1536
int triangleIndex
The triangle index if the shape is a mesh or height-field.
Definition types.h:1485
uint8_t indexB[4]
The cached simplex indices on shape B.
Definition types.h:1515
b3ShapeId shapeId
The shape hit.
Definition types.h:1324
b3Vec3 point
The hit point.
Definition types.h:1617
b3Vec3 pointA
Closest point on shapeA, in shape A's frame.
Definition types.h:1552
int distanceIterations
Number of outer iterations.
Definition types.h:1629
int indexB
wB index
Definition types.h:1568
float maxFraction
Defines the sweep interval [0, tMax].
Definition types.h:1597
b3ShapeProxy proxyA
The proxy for shape A.
Definition types.h:1524
int pushBackIterations
Total number of push back iterations.
Definition types.h:1632
bool useRadii
Should the proxy radius be considered?
Definition types.h:1546
b3ShapeProxy proxyB
The proxy for shape B.
Definition types.h:1594
b3Transform transform
Transform of shape B in shape A's frame, the relative pose B in A (b3InvMulWorldTransforms( worldA,...
Definition types.h:1543
b3Vec3 normal
The surface normal at the hit point.
Definition types.h:1406
b3SimplexVertex vertices[4]
vertices
Definition types.h:1574
b3ShapeProxy proxy
A generic query shape.
Definition types.h:1375
bool hit
Did the cast hit?
Definition types.h:1427
uint64_t userMaterialId
The user material id at the hit point.
Definition types.h:1334
float distance
The final distance, zero if overlapped.
Definition types.h:1555
b3Vec3 localCenter
Local center of mass position.
Definition types.h:1583
int rootIterations
Total number of root iterations.
Definition types.h:1635
float maxFraction
The maximum fraction of the translation to consider, typically 1.
Definition types.h:1399
float maxFraction
The fraction of the translation to consider, typically 1.
Definition types.h:1528
int childIndex
The index of the compound child shape.
Definition types.h:1421
int materialIndex
The material index. May be -1 for null.
Definition types.h:1424
b3Vec3 translationB
The translation of shape B, in A's frame.
Definition types.h:1527
float maxFraction
The maximum fraction of the translation to consider, typically 1.
Definition types.h:1317
b3Vec3 translation
Translation of the ray cast.
Definition types.h:1314
const b3Vec3 * points
The point cloud.
Definition types.h:1360
int iterations
The number of iterations used. Diagnostic.
Definition types.h:1492
int iterations
The number of iterations used.
Definition types.h:1415
b3Sweep sweepA
The movement of shape A.
Definition types.h:1595
b3ShapeProxy proxyA
The proxy for shape A.
Definition types.h:1593
int indexA
wA index
Definition types.h:1567
b3Pos point
The world point of the hit.
Definition types.h:1327
b3Quat q1
Starting world rotation.
Definition types.h:1586
bool canEncroach
Allows shapes with a radius to move slightly closer if already touching.
Definition types.h:1529
float a
barycentric coordinates
Definition types.h:1566
b3Vec3 translation
The translation of the shape cast.
Definition types.h:1378
b3Sweep sweepB
The movement of shape B.
Definition types.h:1596
b3TOIState state
The type of result.
Definition types.h:1614
b3ShapeId shapeId
The shape hit.
Definition types.h:1472
uint64_t categoryBits
The collision category bits of this query. Normally you would just set one bit.
Definition types.h:1286
int iterations
Number of GJK iterations used.
Definition types.h:1556
int count
The number of points. Do not exceed B3_MAX_SHAPE_CAST_POINTS.
Definition types.h:1363
b3Quat q2
Ending world rotation.
Definition types.h:1587
b3AABB box
The AABB to cast, in the tree's frame.
Definition types.h:1393
uint64_t id
Optional id combined with name to identify this query in a recording, e.g.
Definition types.h:1294
int leafVisits
The number of BVH leaves visited. Diagnostic.
Definition types.h:1350
float fraction
The fraction of the input translation at collision.
Definition types.h:1412
b3Vec3 normal
The world normal of the shape surface at the hit point.
Definition types.h:1330
b3QueryFilter b3DefaultQueryFilter(void)
Use this to initialize your query filter.
b3CastOutput b3WorldCastOutput
Same type in single precision.
Definition types.h:1464
b3TOIState
Describes the TOI output.
Definition types.h:1602
Body cast result for ray and shape casts.
Definition types.h:1470
Input for sweeping an AABB through a dynamic tree.
Definition types.h:1391
Low level ray cast or shape-cast output data.
Definition types.h:1404
Input for b3ShapeDistance.
Definition types.h:1534
Output for b3ShapeDistance.
Definition types.h:1551
The query filter is used to filter collisions between queries and shapes.
Definition types.h:1284
Low level ray cast input data.
Definition types.h:1308
Result from b3World_RayCastClosest.
Definition types.h:1322
Low level shape cast input in generic form.
Definition types.h:1373
Input parameters for b3ShapeCast.
Definition types.h:1523
A shape proxy is used by the GJK algorithm. It can represent a convex shape.
Definition types.h:1358
Simplex from the GJK algorithm.
Definition types.h:1573
Used to warm start the GJK simplex.
Definition types.h:1503
Simplex vertex for debugging the GJK algorithm.
Definition types.h:1562
This describes the motion of a body/shape for TOI computation.
Definition types.h:1582
Time of impact input.
Definition types.h:1592
Time of impact output.
Definition types.h:1612
float motorSpeed
The desired motor speed in radians per second.
Definition types.h:853
b3JointDef base
Base joint definition.
Definition types.h:822
float targetAngle
The bodyB angle minus bodyA angle in the reference state (radians).
Definition types.h:826
float dampingRatio
The spring damping ratio, non-dimensional.
Definition types.h:835
float lowerAngle
The lower angle for the joint limit in radians. Minimum of -0.99*pi radians.
Definition types.h:841
bool enableMotor
A flag to enable the joint motor.
Definition types.h:847
float upperAngle
The upper angle for the joint limit in radians. Maximum of 0.99*pi radians.
Definition types.h:844
float maxMotorTorque
The maximum motor torque, typically in newton-meters.
Definition types.h:850
bool enableLimit
A flag to enable joint limits.
Definition types.h:838
float hertz
The spring stiffness Hertz, cycles per second.
Definition types.h:832
bool enableSpring
Enable a rotational spring on the revolute hinge axis.
Definition types.h:829
b3RevoluteJointDef b3DefaultRevoluteJointDef(void)
Use this to initialize your joint definition.
Revolute joint definition.
Definition types.h:820
float restitution
The coefficient of restitution (bounce) usually in the range [0,1].
Definition types.h:405
float explosionScale
Explosion scale for b3World_Explode. non-dimensional.
Definition types.h:474
bool enableSensorEvents
Enable sensor events for this shape. This applies to sensors and non-sensors. False by default,...
Definition types.h:490
bool invokeContactCreation
When shapes are created they will scan the environment for collision the next time step.
Definition types.h:505
bool updateBodyMass
Should the body update the mass properties when this shape is created. Default is true.
Definition types.h:508
float friction
The Coulomb (dry) friction coefficient, usually in the range [0,1].
Definition types.h:401
bool enableCustomFiltering
Enable custom filtering. Only one of the two shapes needs to enable custom filtering....
Definition types.h:480
bool isSensor
A sensor shape generates overlap events but never generates a collision response.
Definition types.h:487
uint64_t categoryBits
The collision category bits.
Definition types.h:372
bool enablePreSolveEvents
Enable pre-solve contact events for this shape.
Definition types.h:500
bool enableHitEvents
Enable hit events for this shape. Only applies to kinematic and dynamic bodies. Ignored for sensors....
Definition types.h:496
b3Filter filter
Contact filtering data.
Definition types.h:477
float density
The density, usually in kg/m^3.
Definition types.h:471
uint32_t customColor
Custom debug draw color.
Definition types.h:421
int groupIndex
Collision groups allow a certain group of objects to never collide (negative) or always collide (posi...
Definition types.h:389
void * userData
Use this to store application specific shape data.
Definition types.h:459
int internalValue
Used internally to detect a valid definition. DO NOT SET.
Definition types.h:511
bool enableContactEvents
Enable contact events for this shape. Only applies to kinematic and dynamic bodies....
Definition types.h:493
float rollingResistance
The rolling resistance usually in the range [0,1]. This is only used for spheres and capsules.
Definition types.h:408
uint64_t userMaterialId
User material identifier.
Definition types.h:416
b3SurfaceMaterial baseMaterial
The base surface material. Ignored for compound shapes.
Definition types.h:468
uint64_t maskBits
The collision mask bits.
Definition types.h:381
b3Vec3 tangentVelocity
The tangent velocity for conveyor belts.
Definition types.h:412
b3SurfaceMaterial * materials
Surface material used on mesh shapes per triangle. Ignored for convex shapes. Ignored for compound sh...
Definition types.h:462
int materialCount
Surface material count.
Definition types.h:465
b3SurfaceMaterial b3DefaultSurfaceMaterial(void)
Use this to initialize your surface material.
b3ShapeType
Shape type.
Definition types.h:431
b3Filter b3DefaultFilter(void)
Use this to initialize your filter.
b3ShapeDef b3DefaultShapeDef(void)
Use this to initialize your shape definition.
@ b3_capsuleShape
A capsule is an extruded sphere.
Definition types.h:433
@ b3_shapeTypeCount
The number of shape types.
Definition types.h:451
@ b3_heightShape
A height field useful for terrain.
Definition types.h:439
@ b3_compoundShape
A compound shape composed of up to 64K spheres, capsules, hulls, and meshes.
Definition types.h:436
@ b3_sphereShape
A sphere with an offset.
Definition types.h:448
@ b3_meshShape
A triangle soup.
Definition types.h:445
@ b3_hullShape
A convex hull.
Definition types.h:442
This is used to filter collision on shapes.
Definition types.h:359
Used to create a shape.
Definition types.h:457
Material properties supported per triangle on meshes and height fields.
Definition types.h:399
b3Vec3 center
The local center.
Definition types.h:1888
float radius
The radius.
Definition types.h:1891
A solid sphere.
Definition types.h:1886
bool enableMotor
A flag to enable the joint motor.
Definition types.h:897
float maxMotorTorque
The maximum motor torque, typically in newton-meters. Non-negative number.
Definition types.h:900
float lowerTwistAngle
The angle for the lower twist limit in radians. Minimum of -0.99*pi radians.
Definition types.h:891
b3Quat targetRotation
Target spring rotation, joint frame B relative to joint frame A.
Definition types.h:879
b3JointDef base
Base joint definition.
Definition types.h:866
bool enableConeLimit
A flag to enable the cone limit. The cone is centered on the frameA z-axis.
Definition types.h:882
bool enableSpring
Enable a rotational spring that attempts to align the two joint frames.
Definition types.h:869
float coneAngle
The angle for the cone limit in radians. Valid range is [0, pi].
Definition types.h:885
bool enableTwistLimit
A flag to enable the twist limit. The twist is centered on the frameB z-axis.
Definition types.h:888
float upperTwistAngle
The angle for the upper twist limit in radians. Maximum of 0.99*pi radians.
Definition types.h:894
float hertz
The spring stiffness Hertz, cycles per second.
Definition types.h:873
float dampingRatio
The spring damping ratio, non-dimensional. Non-negative number.
Definition types.h:876
b3Vec3 motorVelocity
The desired motor angular velocity in radians per second.
Definition types.h:903
b3SphericalJointDef b3DefaultSphericalJointDef(void)
Use this to initialize your joint definition.
Spherical joint definition.
Definition types.h:864
int nodeCapacity
The allocated node space.
Definition types.h:1734
int * binIndices
Bins for sorting during rebuild.
Definition types.h:1752
b3Vec3 * leafCenters
Leaf bounding box centers for rebuild.
Definition types.h:1749
int nodeCount
The number of nodes.
Definition types.h:1731
b3TreeNodeChildren children
Children (internal node).
int child1
child node index 1
Definition types.h:1674
uint64_t version
The dynamic tree version.
Definition types.h:1722
uint64_t userData
User data (leaf node).
int freeList
Node free list.
Definition types.h:1740
int child2
child node index 2
Definition types.h:1675
int rebuildCapacity
Allocated space for rebuilding.
Definition types.h:1755
int nodeVisits
Number of internal nodes visited during the query.
Definition types.h:1762
int root
The root index.
Definition types.h:1728
int leafVisits
Number of leaf nodes visited during the query.
Definition types.h:1765
b3AABB * leafBoxes
Leaf bounding boxes for rebuild.
Definition types.h:1746
b3TreeNode * nodes
The tree nodes.
Definition types.h:1725
int next
The node freelist next index (free node).
int parent
The node parent index (allocated node).
int proxyCount
Number of proxies created.
Definition types.h:1737
int * leafIndices
Leaf indices for rebuild.
Definition types.h:1743
float b3TreeBoxCastCallbackFcn(const b3BoxCastInput *input, int proxyId, uint64_t userData, void *context)
This function receives clipped AABB cast input for a proxy.
Definition types.h:1781
float b3TreeRayCastCallbackFcn(const b3RayCastInput *input, int proxyId, uint64_t userData, void *context)
This function receives clipped ray cast input for a proxy.
Definition types.h:1788
bool b3TreeQueryCallbackFcn(int proxyId, uint64_t userData, void *context)
This function receives proxies found in the AABB query.
Definition types.h:1770
b3TreeNodeFlags
Flags for tree nodes. For internal usage.
Definition types.h:1665
float b3TreeQueryClosestCallbackFcn(float distanceSqrMin, int proxyId, uint64_t userData, void *context)
This function receives the minimum distance squared so far and proxy to check in the closest query.
Definition types.h:1774
The dynamic tree structure.
Definition types.h:1719
Tree node child indices. For internal usage.
Definition types.h:1673
These are performance results returned by dynamic tree queries.
Definition types.h:1760
float angularDampingRatio
Linear damping ratio, non-dimensional. Use 1 for critical damping.
Definition types.h:930
float linearHertz
Linear stiffness expressed as Hertz (cycles per second). Use zero for maximum stiffness.
Definition types.h:921
float linearDampingRatio
Linear damping ratio, non-dimensional. Use 1 for critical damping.
Definition types.h:927
float angularHertz
Angular stiffness as Hertz (cycles per second). Use zero for maximum stiffness.
Definition types.h:924
b3JointDef base
Base joint definition.
Definition types.h:918
b3WeldJointDef b3DefaultWeldJointDef(void)
Use this to initialize your joint definition.
Weld joint definition Connects two bodies together rigidly.
Definition types.h:916
float maxSteeringTorque
The maximum steering torque in N*m.
Definition types.h:988
bool enableSteering
Enable steering, otherwise the steering is fixed forward.
Definition types.h:976
bool enableSuspensionSpring
Enable a linear spring along the local axis.
Definition types.h:949
float lowerSteeringLimit
The lower steering angle in radians.
Definition types.h:994
float spinSpeed
The desired motor speed in radians per second.
Definition types.h:973
bool enableSteeringLimit
Enable/disable the steering angular limit.
Definition types.h:991
float targetSteeringAngle
The target steering angle in radians.
Definition types.h:985
float steeringHertz
Steering stiffness in Hertz.
Definition types.h:979
bool enableSuspensionLimit
Enable/disable the joint linear limit.
Definition types.h:958
float upperSuspensionLimit
The upper translation limit.
Definition types.h:964
float upperSteeringLimit
The upper steering angle in radians.
Definition types.h:997
float lowerSuspensionLimit
The lower suspension translation limit.
Definition types.h:961
float maxSpinTorque
The maximum motor torque, typically in newton-meters.
Definition types.h:970
float suspensionHertz
Spring stiffness in Hertz.
Definition types.h:952
float steeringDampingRatio
Spring damping ratio, non-dimensional.
Definition types.h:982
b3JointDef base
Base joint definition.
Definition types.h:946
bool enableSpinMotor
Enable/disable the joint rotational motor.
Definition types.h:967
float suspensionDampingRatio
Spring damping ratio, non-dimensional.
Definition types.h:955
b3WheelJointDef b3DefaultWheelJointDef(void)
Use this to initialize your joint definition.
Wheel joint definition Body A is the chassis and body B is the wheel.
Definition types.h:944
float contactDampingRatio
Contact bounciness.
Definition types.h:158
float contactHertz
Contact stiffness. Cycles per second. Increasing this increases the speed of overlap recovery,...
Definition types.h:154
b3Capacity capacity
Optional initial capacities.
Definition types.h:211
b3Vec3 gravity
Gravity vector. Box3D has no up-vector defined.
Definition types.h:143
void * userData
User data associated with a world.
Definition types.h:198
b3RestitutionCallback * restitutionCallback
Optional mixing callback for restitution. The default uses max(restitutionA, restitutionB).
Definition types.h:172
float contactSpeed
This parameter controls how fast overlap is resolved and usually has units of meters per second.
Definition types.h:163
float falloff
The falloff distance beyond the radius. Impulse is reduced to zero at this distance.
Definition types.h:1019
uint32_t workerCount
Number of workers to use with the provided task system.
Definition types.h:186
float radius
The radius of the explosion.
Definition types.h:1016
int contactCount
Number of expected contacts.
Definition types.h:135
bool enableContinuous
Enable continuous collision.
Definition types.h:178
int dynamicBodyCount
Number of expected dynamic and kinematic bodies.
Definition types.h:132
b3FrictionCallback * frictionCallback
Optional mixing callback for friction. The default uses sqrt(frictionA * frictionB).
Definition types.h:169
b3Pos position
The center of the explosion in world space.
Definition types.h:1013
b3FinishTaskCallback * finishTask
function to finish a task
Definition types.h:192
int internalValue
Used internally to detect a valid definition. DO NOT SET.
Definition types.h:214
b3DestroyDebugShapeCallback * destroyDebugShape
Used to destroy debug draw shapes. This is called when a shape is modified or destroyed.
Definition types.h:205
void * userDebugShapeContext
This is passed to the debug shape callbacks to provide a user context.
Definition types.h:208
float impulsePerArea
Impulse per unit area.
Definition types.h:1024
int staticBodyCount
Number of expected static bodies.
Definition types.h:129
void * userTaskContext
User context that is provided to enqueueTask and finishTask.
Definition types.h:195
b3CreateDebugShapeCallback * createDebugShape
Used to create debug draw shapes.
Definition types.h:202
float hitEventThreshold
Hit event speed threshold, usually in m/s.
Definition types.h:151
uint64_t maskBits
Mask bits to filter shapes.
Definition types.h:1010
int staticShapeCount
Number of expected static shapes.
Definition types.h:123
int dynamicShapeCount
Number of expected dynamic and kinematic shapes.
Definition types.h:126
float restitutionThreshold
Restitution speed threshold, usually in m/s.
Definition types.h:147
b3EnqueueTaskCallback * enqueueTask
function to spawn task
Definition types.h:189
bool enableSleep
Can bodies go to sleep to improve performance.
Definition types.h:175
float maximumLinearSpeed
Maximum linear speed. Usually meters per second.
Definition types.h:166
void b3TaskCallback(void *taskContext)
Task interface This is the prototype for a Box3D task.
Definition types.h:20
b3WorldDef b3DefaultWorldDef(void)
Use this to initialize your world definition.
bool b3PreSolveFcn(b3ShapeId shapeIdA, b3ShapeId shapeIdB, b3Pos point, b3Vec3 normal, void *context)
Prototype for a pre-solve callback.
Definition types.h:88
b3ExplosionDef b3DefaultExplosionDef(void)
Use this to initialize your explosion definition.
bool b3CustomFilterFcn(b3ShapeId shapeIdA, b3ShapeId shapeIdB, void *context)
Prototype for a contact filter callback.
Definition types.h:73
void * b3EnqueueTaskCallback(b3TaskCallback *task, void *taskContext, void *userContext, const char *taskName)
These functions can be provided to Box3D to invoke a task system.
Definition types.h:31
float b3FrictionCallback(float frictionA, uint64_t userMaterialIdA, float frictionB, uint64_t userMaterialIdB)
Optional friction mixing callback.
Definition types.h:54
float b3RestitutionCallback(float restitutionA, uint64_t userMaterialIdA, float restitutionB, uint64_t userMaterialIdB)
Optional restitution mixing callback.
Definition types.h:60
void b3FinishTaskCallback(void *userTask, void *userContext)
Finishes a user task object that wraps a Box3D task.
Definition types.h:40
bool b3OverlapResultFcn(b3ShapeId shapeId, void *context)
Prototype callback for overlap queries.
Definition types.h:95
float b3CastResultFcn(b3ShapeId shapeId, b3Pos point, b3Vec3 normal, float fraction, uint64_t userMaterialId, int triangleIndex, int childIndex, void *context)
Prototype callback for ray casts.
Definition types.h:115
Optional world capacities that can be use to avoid run-time allocations.
Definition types.h:121
The explosion definition is used to configure options for explosions.
Definition types.h:1008
World definition used to create a simulation world.
Definition types.h:141
Child shape of a compound.
Definition types.h:2518
b3Transform transform
Transform of the shape into compound local space.
Definition types.h:2529
b3ShapeType type
The shape type (union tag).
Definition types.h:2536
int materialIndices[B3_MAX_COMPOUND_MESH_MATERIALS]
Material indices.
Definition types.h:2533
This struct is passed to b3World_Draw to draw a debug view of the simulation world.
Definition types.h:2948
void(* DrawSegmentFcn)(b3Pos p1, b3Pos p2, b3HexColor color, void *context)
Draw a line segment.
Definition types.h:2953
float jointScale
Global scaling for joint drawing.
Definition types.h:2983
bool drawShapes
Option to draw shapes.
Definition types.h:2986
void * context
User context that is passed as an argument to drawing callback functions.
Definition types.h:3028
int drawAnchorA
Draw contact anchor A or B.
Definition types.h:3007
void(* DrawSphereFcn)(b3Pos p, float radius, b3HexColor color, float alpha, void *context)
Draw a sphere.
Definition types.h:2962
bool drawGraphColors
Option to visualize the graph coloring used for contacts and joints.
Definition types.h:3010
void(* DrawStringFcn)(b3Pos p, const char *s, b3HexColor color, void *context)
Draw a string in world space.
Definition types.h:2974
void(* DrawBoundsFcn)(b3AABB aabb, b3HexColor color, void *context)
Draw a bounding box.
Definition types.h:2968
bool drawFrictionForces
Option to draw contact friction forces.
Definition types.h:3022
bool(* DrawShapeFcn)(void *userShape, b3WorldTransform transform, b3HexColor color, void *context)
Draws a shape and returns true if drawing should continue.
Definition types.h:2950
bool drawBounds
Option to draw the bounding boxes for shapes.
Definition types.h:2995
bool drawContacts
Option to draw contact points.
Definition types.h:3004
bool drawContactForces
Option to draw contact normal forces.
Definition types.h:3019
void(* DrawBoxFcn)(b3Vec3 extents, b3WorldTransform transform, b3HexColor color, void *context)
Draw an oriented box.
Definition types.h:2971
bool drawMass
Option to draw the mass and center of mass of dynamic bodies.
Definition types.h:2998
void(* DrawPointFcn)(b3Pos p, float size, b3HexColor color, void *context)
Draw a point.
Definition types.h:2959
bool drawJointExtras
Option to draw additional information for joints.
Definition types.h:2992
b3AABB drawingBounds
World bounds to use for debug draw.
Definition types.h:2977
void(* DrawCapsuleFcn)(b3Pos p1, b3Pos p2, float radius, b3HexColor color, float alpha, void *context)
Draw a capsule.
Definition types.h:2965
bool drawBodyNames
Option to draw body names.
Definition types.h:3001
bool drawJoints
Option to draw joints.
Definition types.h:2989
bool drawIslands
Option to draw islands as bounding boxes.
Definition types.h:3025
void(* DrawTransformFcn)(b3WorldTransform transform, void *context)
Draw a transform. Choose your own length scale.
Definition types.h:2956
bool drawContactFeatures
Option to draw contact features.
Definition types.h:3013
bool drawContactNormals
Option to draw contact normals.
Definition types.h:3016
float forceScale
Scale to use when drawing forces.
Definition types.h:2980
This is sent to the user for debug shape creation.
Definition types.h:2925
b3ShapeType type
Shape type.
Definition types.h:2930
b3ShapeId shapeId
Shape id.
Definition types.h:2927
A mesh BVH node.
Definition types.h:2110
uint32_t triangleOffset
The index of the leaf triangles.
Definition types.h:2141
union b3MeshNode::@177200325063254046111370015225332352105064355320 data
Anonymous union.
b3Vec3 lowerBound
The lower bound of the node AABB. Strategic placement for SIMD.
Definition types.h:2112
b3Vec3 upperBound
The upper bound of the node AABB. Strategic placement for SIMD.
Definition types.h:2138
A node in the dynamic tree.
Definition types.h:1681
uint64_t categoryBits
Category bits for collision filtering.
Definition types.h:1686
uint16_t height
Height of the node. Leaves have a height of 0.
Definition types.h:1707
uint16_t flags
Definition types.h:1710
b3AABB aabb
The node bounding box.
Definition types.h:1683