Box3D 0.1.0
A 3D physics engine for games
Loading...
Searching...
No Matches
box3d.h
1// SPDX-FileCopyrightText: 2025 Erin Catto
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
6#include "base.h"
7#include "collision.h"
8#include "id.h"
9#include "math_functions.h"
10#include "types.h"
11
12#include <stdbool.h>
13
24
25#if defined( BOX3D_DOUBLE_PRECISION )
26// Force a link error if the application and library disagree on precision. A float app linking
27// a double precision library, or the reverse, gets one unresolved external on the first call
28// every program makes. CMake consumers inherit the define and cannot mismatch.
29#define b3CreateWorld b3CreateWorldDoublePrecision
30#endif
31
35B3_API b3WorldId b3CreateWorld( const b3WorldDef* def );
36
38B3_API void b3DestroyWorld( b3WorldId worldId );
39
41B3_API int b3GetWorldCount( void );
42
44B3_API int b3GetMaxWorldCount( void );
45
47B3_API bool b3World_IsValid( b3WorldId id );
48
53B3_API void b3World_Step( b3WorldId worldId, float timeStep, int subStepCount );
54
56B3_API void b3World_Draw( b3WorldId worldId, b3DebugDraw* draw, uint64_t maskBits );
57
61
64
67
70
73
76 void* context );
77
80B3_API b3TreeStats b3World_OverlapShape( b3WorldId worldId, b3Pos origin, const b3ShapeProxy* proxy, b3QueryFilter filter,
81 b3OverlapResultFcn* fcn, void* context );
82
93B3_API b3TreeStats b3World_CastRay( b3WorldId worldId, b3Pos origin, b3Vec3 translation, b3QueryFilter filter,
94 b3CastResultFcn* fcn, void* context );
95
98B3_API b3RayResult b3World_CastRayClosest( b3WorldId worldId, b3Pos origin, b3Vec3 translation, b3QueryFilter filter );
99
104B3_API b3TreeStats b3World_CastShape( b3WorldId worldId, b3Pos origin, const b3ShapeProxy* proxy, b3Vec3 translation,
105 b3QueryFilter filter, b3CastResultFcn* fcn, void* context );
106
118B3_API float b3World_CastMover( b3WorldId worldId, b3Pos origin, const b3Capsule* mover, b3Vec3 translation, b3QueryFilter filter,
119 b3MoverFilterFcn* fcn, void* context );
120
123B3_API void b3World_CollideMover( b3WorldId worldId, b3Pos origin, const b3Capsule* mover, b3QueryFilter filter,
124 b3PlaneResultFcn* fcn, void* context );
125
129B3_API void b3World_EnableSleeping( b3WorldId worldId, bool flag );
130
133
138B3_API void b3World_EnableContinuous( b3WorldId worldId, bool flag );
139
142
146B3_API void b3World_SetRestitutionThreshold( b3WorldId worldId, float value );
147
150
154B3_API void b3World_SetHitEventThreshold( b3WorldId worldId, float value );
155
158
160B3_API void b3World_SetCustomFilterCallback( b3WorldId worldId, b3CustomFilterFcn* fcn, void* context );
161
163B3_API void b3World_SetPreSolveCallback( b3WorldId worldId, b3PreSolveFcn* fcn, void* context );
164
168B3_API void b3World_SetGravity( b3WorldId worldId, b3Vec3 gravity );
169
172
176B3_API void b3World_Explode( b3WorldId worldId, const b3ExplosionDef* explosionDef );
177
184B3_API void b3World_SetContactTuning( b3WorldId worldId, float hertz, float dampingRatio, float contactSpeed );
185
188B3_API void b3World_SetContactRecycleDistance( b3WorldId worldId, float recycleDistance );
189
192
194B3_API void b3World_SetMaximumLinearSpeed( b3WorldId worldId, float maximumLinearSpeed );
195
198
201B3_API void b3World_EnableWarmStarting( b3WorldId worldId, bool flag );
202
205
208
210B3_API b3Profile b3World_GetProfile( b3WorldId worldId );
211
213B3_API b3Counters b3World_GetCounters( b3WorldId worldId );
214
217
219B3_API void b3World_SetUserData( b3WorldId worldId, void* userData );
220
222B3_API void* b3World_GetUserData( b3WorldId worldId );
223
226
229
231B3_API void b3World_SetWorkerCount( b3WorldId worldId, int count );
232
234B3_API int b3World_GetWorkerCount( b3WorldId worldId );
235
237B3_API void b3World_DumpMemoryStats( b3WorldId worldId );
238
240B3_API void b3World_DumpShapeBounds( b3WorldId worldId, b3BodyType type );
241
244
246B3_API void b3World_EnableSpeculative( b3WorldId worldId, bool flag );
247
250B3_API void b3World_DumpAwake( b3WorldId worldId );
251
253B3_API void b3World_Dump( b3WorldId worldId );
254
260
263
267B3_API b3Recording* b3CreateRecording( int byteCapacity );
268
271B3_API void b3DestroyRecording( b3Recording* recording );
272
277B3_API const uint8_t* b3Recording_GetData( const b3Recording* recording );
278
281B3_API int b3Recording_GetSize( const b3Recording* recording );
282
287B3_API void b3World_StartRecording( b3WorldId worldId, b3Recording* recording );
288
292B3_API void b3World_StopRecording( b3WorldId worldId );
293
297B3_API bool b3SaveRecordingToFile( const b3Recording* recording, const char* path );
298
302B3_API b3Recording* b3LoadRecordingFromFile( const char* path );
303
310B3_API bool b3ValidateReplay( const void* data, int size, int workerCount );
311
314
316typedef struct b3RecPlayerInfo
317{
318 int frameCount; // total recorded steps
319 int workerCount; // worker count requested for the replay world
320 float timeStep; // dt of the recorded steps
321 int subStepCount; // recorded sub-steps
322 float lengthScale; // length units per meter in effect when recorded
323 b3AABB bounds; // accumulated world bounds over the recording, zero-extent if unavailable
325
333B3_API b3RecPlayer* b3RecPlayer_Create( const void* data, int size, int workerCount );
334
336B3_API void b3RecPlayer_Destroy( b3RecPlayer* player );
337
340B3_API bool b3RecPlayer_StepFrame( b3RecPlayer* player );
341
343B3_API void b3RecPlayer_Restart( b3RecPlayer* player );
344
347B3_API void b3RecPlayer_SeekFrame( b3RecPlayer* player, int targetFrame );
348
351
353B3_API int b3RecPlayer_GetFrame( const b3RecPlayer* player );
354
356B3_API int b3RecPlayer_GetFrameCount( const b3RecPlayer* player );
357
359B3_API bool b3RecPlayer_IsAtEnd( const b3RecPlayer* player );
360
362B3_API bool b3RecPlayer_HasDiverged( const b3RecPlayer* player );
363
366
368B3_API int b3RecPlayer_GetDivergeFrame( const b3RecPlayer* player );
369
374B3_API void b3RecPlayer_SetWorkerCount( b3RecPlayer* player, int count );
375
383B3_API void b3RecPlayer_SetKeyframePolicy( b3RecPlayer* player, size_t budgetBytes, int minIntervalFrames );
384
386B3_API size_t b3RecPlayer_GetKeyframeBudget( const b3RecPlayer* player );
387
390
394
396B3_API size_t b3RecPlayer_GetKeyframeBytes( const b3RecPlayer* player );
397
399B3_API int b3RecPlayer_GetBodyCount( const b3RecPlayer* player );
400
403B3_API b3BodyId b3RecPlayer_GetBodyId( const b3RecPlayer* player, int index );
404
415 b3DestroyDebugShapeCallback* destroyDebugShape, void* context );
416
423B3_API void b3RecPlayer_DrawFrameQueries( b3RecPlayer* player, b3DebugDraw* draw, int queryIndex, int selectedIndex );
424
426typedef enum b3RecQueryType
427{
428 b3_recQueryOverlapAABB,
429 b3_recQueryOverlapShape,
430 b3_recQueryCastRay,
431 b3_recQueryCastShape,
432 b3_recQueryCastRayClosest,
433 b3_recQueryCastMover,
434 b3_recQueryCollideMover,
436
438typedef struct b3RecQueryInfo
439{
440 b3RecQueryType type;
441 b3QueryFilter filter;
442 b3AABB aabb; // world-space bounds of the query, swept for casts
443 b3Pos origin; // query origin (zero for overlap AABB)
444 b3Vec3 translation; // ray and cast translation
445 int hitCount; // number of recorded results
446 uint64_t key; // identity key, the hash of (id, name), 0 if untagged
447 uint64_t id; // query id, 0 if none
448 const char* name; // query label, NULL if none
450
452typedef struct b3RecQueryHit
453{
454 b3ShapeId shape;
455 b3Pos point;
456 b3Vec3 normal;
457 float fraction;
459
461B3_API int b3RecPlayer_GetFrameQueryCount( const b3RecPlayer* player );
462
464B3_API b3RecQueryInfo b3RecPlayer_GetFrameQuery( const b3RecPlayer* player, int index );
465
467B3_API b3RecQueryHit b3RecPlayer_GetFrameQueryHit( const b3RecPlayer* player, int queryIndex, int hitIndex );
468 // recording
470 // world
472
478
486B3_API b3BodyId b3CreateBody( b3WorldId worldId, const b3BodyDef* def );
487
490B3_API void b3DestroyBody( b3BodyId bodyId );
491
494B3_API bool b3Body_IsValid( b3BodyId id );
495
498
501B3_API void b3Body_SetType( b3BodyId bodyId, b3BodyType type );
502
504B3_API void b3Body_SetName( b3BodyId bodyId, const char* name );
505
507B3_API const char* b3Body_GetName( b3BodyId bodyId );
508
510B3_API void b3Body_SetUserData( b3BodyId bodyId, void* userData );
511
513B3_API void* b3Body_GetUserData( b3BodyId bodyId );
514
517
520
523
527B3_API void b3Body_SetTransform( b3BodyId bodyId, b3Pos position, b3Quat rotation );
528
530B3_API b3Vec3 b3Body_GetLocalPoint( b3BodyId bodyId, b3Pos worldPoint );
531
533B3_API b3Pos b3Body_GetWorldPoint( b3BodyId bodyId, b3Vec3 localPoint );
534
536B3_API b3Vec3 b3Body_GetLocalVector( b3BodyId bodyId, b3Vec3 worldVector );
537
539B3_API b3Vec3 b3Body_GetWorldVector( b3BodyId bodyId, b3Vec3 localVector );
540
543
546
548B3_API void b3Body_SetLinearVelocity( b3BodyId bodyId, b3Vec3 linearVelocity );
549
551B3_API void b3Body_SetAngularVelocity( b3BodyId bodyId, b3Vec3 angularVelocity );
552
557B3_API void b3Body_SetTargetTransform( b3BodyId bodyId, b3WorldTransform target, float timeStep, bool wake );
558
561
564
572B3_API void b3Body_ApplyForce( b3BodyId bodyId, b3Vec3 force, b3Pos point, bool wake );
573
579B3_API void b3Body_ApplyForceToCenter( b3BodyId bodyId, b3Vec3 force, bool wake );
580
586B3_API void b3Body_ApplyTorque( b3BodyId bodyId, b3Vec3 torque, bool wake );
587
598B3_API void b3Body_ApplyLinearImpulse( b3BodyId bodyId, b3Vec3 impulse, b3Pos point, bool wake );
599
607B3_API void b3Body_ApplyLinearImpulseToCenter( b3BodyId bodyId, b3Vec3 impulse, bool wake );
608
616B3_API void b3Body_ApplyAngularImpulse( b3BodyId bodyId, b3Vec3 impulse, bool wake );
617
619B3_API float b3Body_GetMass( b3BodyId bodyId );
620
623
625B3_API float b3Body_GetInverseMass( b3BodyId bodyId );
626
629
632
635
639B3_API void b3Body_SetMassData( b3BodyId bodyId, b3MassData massData );
640
643
650
652B3_API void b3Body_SetLinearDamping( b3BodyId bodyId, float linearDamping );
653
655B3_API float b3Body_GetLinearDamping( b3BodyId bodyId );
656
658B3_API void b3Body_SetAngularDamping( b3BodyId bodyId, float angularDamping );
659
661B3_API float b3Body_GetAngularDamping( b3BodyId bodyId );
662
665B3_API void b3Body_SetGravityScale( b3BodyId bodyId, float gravityScale );
666
668B3_API float b3Body_GetGravityScale( b3BodyId bodyId );
669
671B3_API bool b3Body_IsAwake( b3BodyId bodyId );
672
676B3_API void b3Body_SetAwake( b3BodyId bodyId, bool awake );
677
679B3_API void b3Body_EnableSleep( b3BodyId bodyId, bool enableSleep );
680
682B3_API bool b3Body_IsSleepEnabled( b3BodyId bodyId );
683
685B3_API void b3Body_SetSleepThreshold( b3BodyId bodyId, float sleepThreshold );
686
688B3_API float b3Body_GetSleepThreshold( b3BodyId bodyId );
689
691B3_API bool b3Body_IsEnabled( b3BodyId bodyId );
692
694B3_API void b3Body_Disable( b3BodyId bodyId );
695
697B3_API void b3Body_Enable( b3BodyId bodyId );
698
700B3_API void b3Body_SetMotionLocks( b3BodyId bodyId, b3MotionLocks locks );
701
704
707B3_API void b3Body_SetBullet( b3BodyId bodyId, bool flag );
708
710B3_API bool b3Body_IsBullet( b3BodyId bodyId );
711
717B3_API void b3Body_EnableContactRecycling( b3BodyId bodyId, bool flag );
718
721
724B3_API void b3Body_EnableHitEvents( b3BodyId bodyId, bool enableHitEvents );
725
728
730B3_API int b3Body_GetShapeCount( b3BodyId bodyId );
731
734B3_API int b3Body_GetShapes( b3BodyId bodyId, b3ShapeId* shapeArray, int capacity );
735
737B3_API int b3Body_GetJointCount( b3BodyId bodyId );
738
741B3_API int b3Body_GetJoints( b3BodyId bodyId, b3JointId* jointArray, int capacity );
742
745
747B3_API int b3Body_GetContactData( b3BodyId bodyId, b3ContactData* contactData, int capacity );
748
752
754B3_API float b3Body_GetClosestPoint( b3BodyId bodyId, b3Vec3* result, b3Vec3 target );
755
757B3_API b3BodyCastResult b3Body_CastRay( b3BodyId bodyId, b3Pos origin, b3Vec3 translation, b3QueryFilter filter,
758 float maxFraction, b3WorldTransform bodyTransform );
759
761B3_API b3BodyCastResult b3Body_CastShape( b3BodyId bodyId, b3Pos origin, const b3ShapeProxy* proxy, b3Vec3 translation,
762 b3QueryFilter filter, float maxFraction, bool canEncroach,
763 b3WorldTransform bodyTransform );
764
766B3_API bool b3Body_OverlapShape( b3BodyId bodyId, b3Pos origin, const b3ShapeProxy* proxy, b3QueryFilter filter,
767 b3WorldTransform bodyTransform );
768
770B3_API int b3Body_CollideMover( b3BodyId bodyId, b3BodyPlaneResult* bodyPlanes, int planeCapacity, b3Pos origin, const b3Capsule* mover,
771 b3QueryFilter filter, b3WorldTransform bodyTransform );
772 // body
774
781
785B3_API b3ShapeId b3CreateSphereShape( b3BodyId bodyId, const b3ShapeDef* def, const b3Sphere* sphere );
786
790B3_API b3ShapeId b3CreateCapsuleShape( b3BodyId bodyId, const b3ShapeDef* def, const b3Capsule* capsule );
791
795B3_API b3ShapeId b3CreateHullShape( b3BodyId bodyId, const b3ShapeDef* def, const b3HullData* hull );
796
802 b3Transform transform, b3Vec3 scale );
803
809B3_API b3ShapeId b3CreateMeshShape( b3BodyId bodyId, const b3ShapeDef* def, const b3MeshData* mesh, b3Vec3 scale );
810
816B3_API b3ShapeId b3CreateHeightFieldShape( b3BodyId bodyId, const b3ShapeDef* def, const b3HeightFieldData* heightField );
817
819B3_API b3ShapeId b3CreateCompoundShape( b3BodyId bodyId, b3ShapeDef* def, const b3CompoundData* compound );
820
824B3_API void b3DestroyShape( b3ShapeId shapeId, bool updateBodyMass );
825
827B3_API bool b3Shape_IsValid( b3ShapeId id );
828
831
834
837
839B3_API bool b3Shape_IsSensor( b3ShapeId shapeId );
840
842B3_API void b3Shape_SetUserData( b3ShapeId shapeId, void* userData );
843
846B3_API void* b3Shape_GetUserData( b3ShapeId shapeId );
847
851B3_API void b3Shape_SetDensity( b3ShapeId shapeId, float density, bool updateBodyMass );
852
854B3_API float b3Shape_GetDensity( b3ShapeId shapeId );
855
857B3_API void b3Shape_SetFriction( b3ShapeId shapeId, float friction );
858
860B3_API float b3Shape_GetFriction( b3ShapeId shapeId );
861
863B3_API void b3Shape_SetRestitution( b3ShapeId shapeId, float restitution );
864
866B3_API float b3Shape_GetRestitution( b3ShapeId shapeId );
867
869B3_API void b3Shape_SetSurfaceMaterial( b3ShapeId shapeId, b3SurfaceMaterial surfaceMaterial );
870
873
876
878B3_API void b3Shape_SetMeshMaterial( b3ShapeId shapeId, b3SurfaceMaterial surfaceMaterial, int index );
879
882
885
891B3_API void b3Shape_SetFilter( b3ShapeId shapeId, b3Filter filter, bool invokeContacts );
892
895B3_API void b3Shape_EnableSensorEvents( b3ShapeId shapeId, bool flag );
896
899
902B3_API void b3Shape_EnableContactEvents( b3ShapeId shapeId, bool flag );
903
906
910B3_API void b3Shape_EnablePreSolveEvents( b3ShapeId shapeId, bool flag );
911
914
917B3_API void b3Shape_EnableHitEvents( b3ShapeId shapeId, bool flag );
918
921
924B3_API b3WorldCastOutput b3Shape_RayCast( b3ShapeId shapeId, b3Pos origin, b3Vec3 translation );
925
928
931
933B3_API const b3HullData* b3Shape_GetHull( b3ShapeId shapeId );
934
937
940
944B3_API void b3Shape_SetSphere( b3ShapeId shapeId, const b3Sphere* sphere );
945
949B3_API void b3Shape_SetCapsule( b3ShapeId shapeId, const b3Capsule* capsule );
950
954B3_API void b3Shape_SetHull( b3ShapeId shapeId, const b3HullData* hull );
955
959B3_API void b3Shape_SetMesh( b3ShapeId shapeId, const b3MeshData* meshData, b3Vec3 scale );
960
963
968B3_API int b3Shape_GetContactData( b3ShapeId shapeId, b3ContactData* contactData, int capacity );
969
975
983B3_API int b3Shape_GetSensorData( b3ShapeId shapeId, b3ShapeId* visitorIds, int capacity );
984
987
990
993
1003B3_API void b3Shape_ApplyWind( b3ShapeId shapeId, b3Vec3 wind, float drag, float lift, float maxSpeed, bool wake );
1004 // shape
1006
1012
1014B3_API void b3DestroyJoint( b3JointId jointId, bool wakeAttached );
1015
1017B3_API bool b3Joint_IsValid( b3JointId id );
1018
1021
1024
1027
1030
1032B3_API void b3Joint_SetLocalFrameA( b3JointId jointId, b3Transform localFrame );
1033
1036
1038B3_API void b3Joint_SetLocalFrameB( b3JointId jointId, b3Transform localFrame );
1039
1042
1044B3_API void b3Joint_SetCollideConnected( b3JointId jointId, bool shouldCollide );
1045
1048
1050B3_API void b3Joint_SetUserData( b3JointId jointId, void* userData );
1051
1053B3_API void* b3Joint_GetUserData( b3JointId jointId );
1054
1056B3_API void b3Joint_WakeBodies( b3JointId jointId );
1057
1060
1063
1066
1069
1074B3_API void b3Joint_SetConstraintTuning( b3JointId jointId, float hertz, float dampingRatio );
1075
1077B3_API void b3Joint_GetConstraintTuning( b3JointId jointId, float* hertz, float* dampingRatio );
1078
1080B3_API void b3Joint_SetForceThreshold( b3JointId jointId, float threshold );
1081
1083B3_API float b3Joint_GetForceThreshold( b3JointId jointId );
1084
1086B3_API void b3Joint_SetTorqueThreshold( b3JointId jointId, float threshold );
1087
1090
1096
1100
1102B3_API void b3ParallelJoint_SetSpringHertz( b3JointId jointId, float hertz );
1103
1105B3_API void b3ParallelJoint_SetSpringDampingRatio( b3JointId jointId, float dampingRatio );
1106
1109
1112
1114B3_API void b3ParallelJoint_SetMaxTorque( b3JointId jointId, float force );
1115
1118 // parallel_joint
1120
1126
1130
1134B3_API void b3DistanceJoint_SetLength( b3JointId jointId, float length );
1135
1137B3_API float b3DistanceJoint_GetLength( b3JointId jointId );
1138
1140B3_API void b3DistanceJoint_EnableSpring( b3JointId jointId, bool enableSpring );
1141
1144
1146B3_API void b3DistanceJoint_SetSpringForceRange( b3JointId jointId, float lowerForce, float upperForce );
1147
1149B3_API void b3DistanceJoint_GetSpringForceRange( b3JointId jointId, float* lowerForce, float* upperForce );
1150
1152B3_API void b3DistanceJoint_SetSpringHertz( b3JointId jointId, float hertz );
1153
1155B3_API void b3DistanceJoint_SetSpringDampingRatio( b3JointId jointId, float dampingRatio );
1156
1159
1162
1165B3_API void b3DistanceJoint_EnableLimit( b3JointId jointId, bool enableLimit );
1166
1169
1171B3_API void b3DistanceJoint_SetLengthRange( b3JointId jointId, float minLength, float maxLength );
1172
1175
1178
1181
1183B3_API void b3DistanceJoint_EnableMotor( b3JointId jointId, bool enableMotor );
1184
1187
1189B3_API void b3DistanceJoint_SetMotorSpeed( b3JointId jointId, float motorSpeed );
1190
1193
1195B3_API void b3DistanceJoint_SetMaxMotorForce( b3JointId jointId, float force );
1196
1199
1202 // distance_joint
1204
1216
1220
1222B3_API void b3MotorJoint_SetLinearVelocity( b3JointId jointId, b3Vec3 velocity );
1223
1226
1228B3_API void b3MotorJoint_SetAngularVelocity( b3JointId jointId, b3Vec3 velocity );
1229
1232
1234B3_API void b3MotorJoint_SetMaxVelocityForce( b3JointId jointId, float maxForce );
1235
1238
1240B3_API void b3MotorJoint_SetMaxVelocityTorque( b3JointId jointId, float maxTorque );
1241
1244
1246B3_API void b3MotorJoint_SetLinearHertz( b3JointId jointId, float hertz );
1247
1250
1252B3_API void b3MotorJoint_SetLinearDampingRatio( b3JointId jointId, float damping );
1253
1256
1258B3_API void b3MotorJoint_SetAngularHertz( b3JointId jointId, float hertz );
1259
1262
1264B3_API void b3MotorJoint_SetAngularDampingRatio( b3JointId jointId, float damping );
1265
1268
1270B3_API void b3MotorJoint_SetMaxSpringForce( b3JointId jointId, float maxForce );
1271
1274
1276B3_API void b3MotorJoint_SetMaxSpringTorque( b3JointId jointId, float maxTorque );
1277
1280 // motor_joint
1282
1291
1295 // filter_joint
1297
1306
1310
1312B3_API void b3PrismaticJoint_EnableSpring( b3JointId jointId, bool enableSpring );
1313
1316
1320B3_API void b3PrismaticJoint_SetSpringHertz( b3JointId jointId, float hertz );
1321
1324
1326B3_API void b3PrismaticJoint_SetSpringDampingRatio( b3JointId jointId, float dampingRatio );
1327
1330
1332B3_API void b3PrismaticJoint_SetTargetTranslation( b3JointId jointId, float targetTranslation );
1333
1336
1338B3_API void b3PrismaticJoint_EnableLimit( b3JointId jointId, bool enableLimit );
1339
1342
1345
1348
1350B3_API void b3PrismaticJoint_SetLimits( b3JointId jointId, float lower, float upper );
1351
1353B3_API void b3PrismaticJoint_EnableMotor( b3JointId jointId, bool enableMotor );
1354
1357
1359B3_API void b3PrismaticJoint_SetMotorSpeed( b3JointId jointId, float motorSpeed );
1360
1363
1365B3_API void b3PrismaticJoint_SetMaxMotorForce( b3JointId jointId, float force );
1366
1369
1372
1375
1377B3_API float b3PrismaticJoint_GetSpeed( b3JointId jointId );
1378 // prismatic_joint
1380
1388
1392
1394B3_API void b3RevoluteJoint_EnableSpring( b3JointId jointId, bool enableSpring );
1395
1398
1400B3_API void b3RevoluteJoint_SetSpringHertz( b3JointId jointId, float hertz );
1401
1404
1406B3_API void b3RevoluteJoint_SetSpringDampingRatio( b3JointId jointId, float dampingRatio );
1407
1410
1412B3_API void b3RevoluteJoint_SetTargetAngle( b3JointId jointId, float targetRadians );
1413
1416
1419B3_API float b3RevoluteJoint_GetAngle( b3JointId jointId );
1420
1422B3_API void b3RevoluteJoint_EnableLimit( b3JointId jointId, bool enableLimit );
1423
1426
1429
1432
1434B3_API void b3RevoluteJoint_SetLimits( b3JointId jointId, float lowerLimitRadians, float upperLimitRadians );
1435
1437B3_API void b3RevoluteJoint_EnableMotor( b3JointId jointId, bool enableMotor );
1438
1441
1443B3_API void b3RevoluteJoint_SetMotorSpeed( b3JointId jointId, float motorSpeed );
1444
1447
1450
1452B3_API void b3RevoluteJoint_SetMaxMotorTorque( b3JointId jointId, float torque );
1453
1456 // revolute_joint
1458
1466
1470
1472B3_API void b3SphericalJoint_EnableConeLimit( b3JointId jointId, bool enableLimit );
1473
1476
1479
1481B3_API void b3SphericalJoint_SetConeLimit( b3JointId jointId, float angleRadians );
1482
1485
1487B3_API void b3SphericalJoint_EnableTwistLimit( b3JointId jointId, bool enableLimit );
1488
1491
1494
1497
1499B3_API void b3SphericalJoint_SetTwistLimits( b3JointId jointId, float lowerLimitRadians, float upperLimitRadians );
1500
1503
1505B3_API void b3SphericalJoint_EnableSpring( b3JointId jointId, bool enableSpring );
1506
1509
1511B3_API void b3SphericalJoint_SetSpringHertz( b3JointId jointId, float hertz );
1512
1515
1517B3_API void b3SphericalJoint_SetSpringDampingRatio( b3JointId jointId, float dampingRatio );
1518
1521
1523B3_API void b3SphericalJoint_SetTargetRotation( b3JointId jointId, b3Quat targetRotation );
1524
1527
1529B3_API void b3SphericalJoint_EnableMotor( b3JointId jointId, bool enableMotor );
1530
1533
1535B3_API void b3SphericalJoint_SetMotorVelocity( b3JointId jointId, b3Vec3 motorVelocity );
1536
1539
1542
1544B3_API void b3SphericalJoint_SetMaxMotorTorque( b3JointId jointId, float torque );
1545
1548 // spherical_joint
1550
1561
1565
1567B3_API void b3WeldJoint_SetLinearHertz( b3JointId jointId, float hertz );
1568
1571
1573B3_API void b3WeldJoint_SetLinearDampingRatio( b3JointId jointId, float dampingRatio );
1574
1577
1579B3_API void b3WeldJoint_SetAngularHertz( b3JointId jointId, float hertz );
1580
1583
1585B3_API void b3WeldJoint_SetAngularDampingRatio( b3JointId jointId, float dampingRatio );
1586
1589 // weld_joint
1591
1601
1605
1607B3_API void b3WheelJoint_EnableSuspension( b3JointId jointId, bool flag );
1608
1611
1613B3_API void b3WheelJoint_SetSuspensionHertz( b3JointId jointId, float hertz );
1614
1617
1619B3_API void b3WheelJoint_SetSuspensionDampingRatio( b3JointId jointId, float dampingRatio );
1620
1623
1625B3_API void b3WheelJoint_EnableSuspensionLimit( b3JointId jointId, bool flag );
1626
1629
1632
1635
1637B3_API void b3WheelJoint_SetSuspensionLimits( b3JointId jointId, float lower, float upper );
1638
1640B3_API void b3WheelJoint_EnableSpinMotor( b3JointId jointId, bool flag );
1641
1644
1646B3_API void b3WheelJoint_SetSpinMotorSpeed( b3JointId jointId, float speed );
1647
1650
1652B3_API void b3WheelJoint_SetMaxSpinTorque( b3JointId jointId, float torque );
1653
1656
1658B3_API float b3WheelJoint_GetSpinSpeed( b3JointId jointId );
1659
1662
1664B3_API void b3WheelJoint_EnableSteering( b3JointId jointId, bool flag );
1665
1668
1670B3_API void b3WheelJoint_SetSteeringHertz( b3JointId jointId, float hertz );
1671
1674
1676B3_API void b3WheelJoint_SetSteeringDampingRatio( b3JointId jointId, float dampingRatio );
1677
1680
1682B3_API void b3WheelJoint_SetMaxSteeringTorque( b3JointId jointId, float torque );
1683
1686
1688B3_API void b3WheelJoint_EnableSteeringLimit( b3JointId jointId, bool flag );
1689
1692
1695
1698
1700B3_API void b3WheelJoint_SetSteeringLimits( b3JointId jointId, float lowerRadians, float upperRadians );
1701
1703B3_API void b3WheelJoint_SetTargetSteeringAngle( b3JointId jointId, float radians );
1704
1707
1710
1713 // wheel_joint
1715 // joint
1717
1723
1726
1729 // contact
void b3Body_SetUserData(b3BodyId bodyId, void *userData)
Set the user data for a body.
b3BodyCastResult b3Body_CastRay(b3BodyId bodyId, b3Pos origin, b3Vec3 translation, b3QueryFilter filter, float maxFraction, b3WorldTransform bodyTransform)
Cast a ray at a specific body using a specified body transform.
void b3Body_ApplyForceToCenter(b3BodyId bodyId, b3Vec3 force, bool wake)
Apply a force to the center of mass.
b3BodyType
The body simulation type.
Definition types.h:225
bool b3Body_IsValid(b3BodyId id)
Body identifier validation.
void b3Body_SetGravityScale(b3BodyId bodyId, float gravityScale)
Adjust the gravity scale.
float b3Body_GetSleepThreshold(b3BodyId bodyId)
Get the sleep threshold, usually in meters per second.
void b3Body_SetSleepThreshold(b3BodyId bodyId, float sleepThreshold)
Set the sleep threshold, usually in meters per second.
b3Vec3 b3Body_GetAngularVelocity(b3BodyId bodyId)
Get the angular velocity of a body in radians per second.
void b3Body_EnableHitEvents(b3BodyId bodyId, bool enableHitEvents)
Enable/disable hit events on all shapes.
void b3Body_SetTransform(b3BodyId bodyId, b3Pos position, b3Quat rotation)
Set the world transform of a body.
b3Vec3 b3Body_GetLinearVelocity(b3BodyId bodyId)
Get the linear velocity of a body's center of mass. Usually in meters per second.
int b3Body_GetContactData(b3BodyId bodyId, b3ContactData *contactData, int capacity)
Get the touching contact data for a body.
void b3Body_SetTargetTransform(b3BodyId bodyId, b3WorldTransform target, float timeStep, bool wake)
Set the velocity to reach the given transform after a given time step.
void b3Body_Disable(b3BodyId bodyId)
Disable a body by removing it completely from the simulation. This is expensive.
void b3Body_ApplyLinearImpulse(b3BodyId bodyId, b3Vec3 impulse, b3Pos point, bool wake)
Apply an impulse at a point.
int b3Body_CollideMover(b3BodyId bodyId, b3BodyPlaneResult *bodyPlanes, int planeCapacity, b3Pos origin, const b3Capsule *mover, b3QueryFilter filter, b3WorldTransform bodyTransform)
Collide a character mover with a specific body using a specified body transform.
const char * b3Body_GetName(b3BodyId bodyId)
Get the body name.
void b3Body_ApplyMassFromShapes(b3BodyId bodyId)
This updates the mass properties to the sum of the mass properties of the shapes.
b3Pos b3Body_GetPosition(b3BodyId bodyId)
Get the world position of a body. This is the location of the body origin.
void b3Body_SetAngularVelocity(b3BodyId bodyId, b3Vec3 angularVelocity)
Set the angular velocity of a body in radians per second.
b3Vec3 b3Body_GetLocalCenterOfMass(b3BodyId bodyId)
Get the center of mass position of the body in local space.
int b3Body_GetShapes(b3BodyId bodyId, b3ShapeId *shapeArray, int capacity)
Get the shape ids for all shapes on this body, up to the provided capacity.
b3Quat b3Body_GetRotation(b3BodyId bodyId)
Get the world rotation of a body as a quaternion.
void b3Body_SetBullet(b3BodyId bodyId, bool flag)
Set this body to be a bullet.
bool b3Body_IsContactRecyclingEnabled(b3BodyId bodyId)
Is contact recycling enabled on this body?
int b3Body_GetJointCount(b3BodyId bodyId)
Get the number of joints on this body.
void b3Body_Enable(b3BodyId bodyId)
Enable a body by adding it to the simulation. This is expensive.
void b3DestroyBody(b3BodyId bodyId)
Destroy a rigid body given an id.
void b3Body_SetAwake(b3BodyId bodyId, bool awake)
Wake a body from sleep.
b3Vec3 b3Body_GetLocalPointVelocity(b3BodyId bodyId, b3Vec3 localPoint)
Get the linear velocity of a local point attached to a body. Usually in meters per second.
void b3Body_SetAngularDamping(b3BodyId bodyId, float angularDamping)
Adjust the angular damping. Normally this is set in b3BodyDef before creation.
void b3Body_ApplyLinearImpulseToCenter(b3BodyId bodyId, b3Vec3 impulse, bool wake)
Apply an impulse to the center of mass.
float b3Body_GetAngularDamping(b3BodyId bodyId)
Get the current angular damping.
b3BodyCastResult b3Body_CastShape(b3BodyId bodyId, b3Pos origin, const b3ShapeProxy *proxy, b3Vec3 translation, b3QueryFilter filter, float maxFraction, bool canEncroach, b3WorldTransform bodyTransform)
Cast a shape at a specific body using a specified body transform.
int b3Body_GetShapeCount(b3BodyId bodyId)
Get the number of shapes on this body.
b3Pos b3Body_GetWorldPoint(b3BodyId bodyId, b3Vec3 localPoint)
Get a world point on a body given a local point.
b3WorldId b3Body_GetWorld(b3BodyId bodyId)
Get the world that owns this body.
float b3Body_GetInverseMass(b3BodyId bodyId)
Get the inverse mass of the body, usually in 1/kilograms.
float b3Body_GetLinearDamping(b3BodyId bodyId)
Get the current linear damping.
void b3Body_ApplyAngularImpulse(b3BodyId bodyId, b3Vec3 impulse, bool wake)
Apply an angular impulse in world space.
void b3Body_SetName(b3BodyId bodyId, const char *name)
Set the body name. Up to B3_BODY_NAME_LENGTH characters including null termination.
float b3Body_GetMass(b3BodyId bodyId)
Get the mass of the body, usually in kilograms.
bool b3Body_IsSleepEnabled(b3BodyId bodyId)
Returns true if sleeping is enabled for this body.
float b3Body_GetGravityScale(b3BodyId bodyId)
Get the current gravity scale.
b3WorldTransform b3Body_GetTransform(b3BodyId bodyId)
Get the world transform of a body.
b3BodyId b3CreateBody(b3WorldId worldId, const b3BodyDef *def)
Create a rigid body given a definition.
void b3Body_EnableSleep(b3BodyId bodyId, bool enableSleep)
Enable or disable sleeping for this body. If sleeping is disabled the body will wake.
bool b3Body_IsBullet(b3BodyId bodyId)
Is this body a bullet?
b3Pos b3Body_GetWorldCenterOfMass(b3BodyId bodyId)
Get the center of mass position of the body in world space.
void b3Body_SetMassData(b3BodyId bodyId, b3MassData massData)
Override the body's mass properties.
void b3Body_EnableContactRecycling(b3BodyId bodyId, bool flag)
Enable or disable contact recycling for this body.
float b3Body_GetClosestPoint(b3BodyId bodyId, b3Vec3 *result, b3Vec3 target)
Get the closest point on a body to a world target.
b3AABB b3Body_ComputeAABB(b3BodyId bodyId)
Get the current world AABB that contains all the attached shapes.
b3Vec3 b3Body_GetLocalVector(b3BodyId bodyId, b3Vec3 worldVector)
Get a local vector on a body given a world vector.
bool b3Body_IsAwake(b3BodyId bodyId)
b3BodyType b3Body_GetType(b3BodyId bodyId)
Get the body type: static, kinematic, or dynamic.
void b3Body_SetLinearVelocity(b3BodyId bodyId, b3Vec3 linearVelocity)
Set the linear velocity of a body. Usually in meters per second.
bool b3Body_IsEnabled(b3BodyId bodyId)
Returns true if this body is enabled.
b3Vec3 b3Body_GetLocalPoint(b3BodyId bodyId, b3Pos worldPoint)
Get a local point on a body given a world point.
void b3Body_ApplyTorque(b3BodyId bodyId, b3Vec3 torque, bool wake)
Apply a torque.
b3Vec3 b3Body_GetWorldPointVelocity(b3BodyId bodyId, b3Pos worldPoint)
Get the linear velocity of a world point attached to a body. Usually in meters per second.
void b3Body_SetLinearDamping(b3BodyId bodyId, float linearDamping)
Adjust the linear damping. Normally this is set in b3BodyDef before creation.
void b3Body_SetType(b3BodyId bodyId, b3BodyType type)
Change the body type.
void b3Body_ApplyForce(b3BodyId bodyId, b3Vec3 force, b3Pos point, bool wake)
Apply a force at a world point.
void b3Body_SetMotionLocks(b3BodyId bodyId, b3MotionLocks locks)
Set the motion locks on this body.
void * b3Body_GetUserData(b3BodyId bodyId)
Get the user data stored in a body.
b3Matrix3 b3Body_GetWorldInverseRotationalInertia(b3BodyId bodyId)
Get the inverse rotational inertia of the body in world space, usually in 1/kg*m^2.
b3Matrix3 b3Body_GetLocalRotationalInertia(b3BodyId bodyId)
Get the rotational inertia of the body in local space, usually in kg*m^2.
b3Vec3 b3Body_GetWorldVector(b3BodyId bodyId, b3Vec3 localVector)
Get a world vector on a body given a local vector.
int b3Body_GetContactCapacity(b3BodyId bodyId)
Get the maximum capacity required for retrieving all the touching contacts on a body.
b3MotionLocks b3Body_GetMotionLocks(b3BodyId bodyId)
Get the motion locks for this body.
int b3Body_GetJoints(b3BodyId bodyId, b3JointId *jointArray, int capacity)
Get the joint ids for all joints on this body, up to the provided capacity.
bool b3Body_OverlapShape(b3BodyId bodyId, b3Pos origin, const b3ShapeProxy *proxy, b3QueryFilter filter, b3WorldTransform bodyTransform)
Overlap a shape with a specific body using a specified body transform.
b3MassData b3Body_GetMassData(b3BodyId bodyId)
Get the mass data for a body.
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
A solid capsule can be viewed as two hemispheres connected by a rectangle.
Definition types.h:1905
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
The runtime data for a compound shape.
Definition types.h:2414
b3ContactData b3Contact_GetData(b3ContactId contactId)
Get the manifolds for a contact. The manifold may have no points if the contact is not touching.
bool b3Contact_IsValid(b3ContactId id)
Contact identifier validation. Provides validation for up to 2^32 allocations.
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
void b3DistanceJoint_EnableMotor(b3JointId jointId, bool enableMotor)
Enable/disable the distance joint motor.
void b3DistanceJoint_SetSpringHertz(b3JointId jointId, float hertz)
Set the spring stiffness in Hertz.
void b3DistanceJoint_GetSpringForceRange(b3JointId jointId, float *lowerForce, float *upperForce)
Get the force range for the spring.
float b3DistanceJoint_GetMinLength(b3JointId jointId)
Get the distance joint minimum length.
void b3DistanceJoint_SetLengthRange(b3JointId jointId, float minLength, float maxLength)
Set the minimum and maximum length parameters of a distance joint.
void b3DistanceJoint_SetSpringDampingRatio(b3JointId jointId, float dampingRatio)
Set the spring damping ratio, non-dimensional.
b3JointId b3CreateDistanceJoint(b3WorldId worldId, const b3DistanceJointDef *def)
Create a distance joint.
void b3DistanceJoint_SetMaxMotorForce(b3JointId jointId, float force)
Set the distance joint maximum motor force, usually in newtons.
float b3DistanceJoint_GetMotorSpeed(b3JointId jointId)
Get the distance joint motor speed, usually in meters per second.
float b3DistanceJoint_GetMaxLength(b3JointId jointId)
Get the distance joint maximum length.
float b3DistanceJoint_GetSpringDampingRatio(b3JointId jointId)
Get the spring damping ratio.
float b3DistanceJoint_GetMaxMotorForce(b3JointId jointId)
Get the distance joint maximum motor force, usually in newtons.
bool b3DistanceJoint_IsMotorEnabled(b3JointId jointId)
Is the distance joint motor enabled?
void b3DistanceJoint_EnableLimit(b3JointId jointId, bool enableLimit)
Enable joint limit.
float b3DistanceJoint_GetLength(b3JointId jointId)
Get the rest length of a distance joint.
float b3DistanceJoint_GetCurrentLength(b3JointId jointId)
Get the current length of a distance joint.
void b3DistanceJoint_SetLength(b3JointId jointId, float length)
Set the rest length of a distance joint.
void b3DistanceJoint_EnableSpring(b3JointId jointId, bool enableSpring)
Enable/disable the distance joint spring. When disabled the distance joint is rigid.
bool b3DistanceJoint_IsSpringEnabled(b3JointId jointId)
Is the distance joint spring enabled?
float b3DistanceJoint_GetMotorForce(b3JointId jointId)
Get the distance joint current motor force, usually in newtons.
bool b3DistanceJoint_IsLimitEnabled(b3JointId jointId)
Is the distance joint limit enabled?
void b3DistanceJoint_SetMotorSpeed(b3JointId jointId, float motorSpeed)
Set the distance joint motor speed, usually in meters per second.
float b3DistanceJoint_GetSpringHertz(b3JointId jointId)
Get the spring Hertz.
void b3DistanceJoint_SetSpringForceRange(b3JointId jointId, float lowerForce, float upperForce)
Set the force range for the spring.
Distance joint definition.
Definition types.h:648
Body events are buffered in the world and are available as event arrays after the time step is comple...
Definition types.h:1216
The contact data for two shapes.
Definition types.h:1251
Contact events are buffered in the world and are available as event arrays after the time step is com...
Definition types.h:1167
Joint events are buffered in the world and are available as event arrays after the time step is compl...
Definition types.h:1239
Sensor events are buffered in the world and are available as begin/end overlap event arrays after the...
Definition types.h:1079
b3JointId b3CreateFilterJoint(b3WorldId worldId, const b3FilterJointDef *def)
Create a filter joint.
A filter joint is used to disable collision between two specific bodies.
Definition types.h:739
This holds the mass data computed for a shape.
Definition types.h:1867
A height field with compressed storage.
Definition types.h:2260
A convex hull.
Definition types.h:1964
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
World id references a world instance. This should be treated as an opaque handle.
Definition id.h:38
b3JointType
Joint type enumeration.
Definition types.h:587
b3Vec3 b3Joint_GetConstraintForce(b3JointId jointId)
Get the current constraint force for this joint.
void * b3Joint_GetUserData(b3JointId jointId)
Get the user data on a joint.
float b3Joint_GetAngularSeparation(b3JointId jointId)
Get the current angular separation error for this joint. Does not consider admissible movement....
bool b3Joint_GetCollideConnected(b3JointId jointId)
Is collision allowed between connected bodies?
b3JointType b3Joint_GetType(b3JointId jointId)
Get the joint type.
void b3Joint_SetLocalFrameA(b3JointId jointId, b3Transform localFrame)
Set the local frame on bodyA.
float b3Joint_GetForceThreshold(b3JointId jointId)
Get the force threshold for joint events (Newtons).
void b3DestroyJoint(b3JointId jointId, bool wakeAttached)
Destroy a joint.
void b3Joint_SetForceThreshold(b3JointId jointId, float threshold)
Set the force threshold for joint events (Newtons).
b3Transform b3Joint_GetLocalFrameA(b3JointId jointId)
Get the local frame on bodyA.
void b3Joint_SetCollideConnected(b3JointId jointId, bool shouldCollide)
Toggle collision between connected bodies.
b3BodyId b3Joint_GetBodyA(b3JointId jointId)
Get body A id on a joint.
bool b3Joint_IsValid(b3JointId id)
Joint identifier validation. Provides validation for up to 64K allocations.
b3Vec3 b3Joint_GetConstraintTorque(b3JointId jointId)
Get the current constraint torque for this joint.
b3BodyId b3Joint_GetBodyB(b3JointId jointId)
Get body B id on a joint.
void b3Joint_SetConstraintTuning(b3JointId jointId, float hertz, float dampingRatio)
Set the joint constraint tuning.
void b3Joint_SetLocalFrameB(b3JointId jointId, b3Transform localFrame)
Set the local frame on bodyB.
b3WorldId b3Joint_GetWorld(b3JointId jointId)
Get the world that owns this joint.
b3Transform b3Joint_GetLocalFrameB(b3JointId jointId)
Get the local frame on bodyB.
float b3Joint_GetTorqueThreshold(b3JointId jointId)
Get the torque threshold for joint events (N-m).
void b3Joint_GetConstraintTuning(b3JointId jointId, float *hertz, float *dampingRatio)
Get the joint constraint tuning. Advanced feature.
void b3Joint_SetTorqueThreshold(b3JointId jointId, float threshold)
Set the torque threshold for joint events (N-m).
void b3Joint_SetUserData(b3JointId jointId, void *userData)
Set the user data on a joint.
void b3Joint_WakeBodies(b3JointId jointId)
Wake the bodies connect to this joint.
float b3Joint_GetLinearSeparation(b3JointId jointId)
Get the current linear separation error for this joint. Does not consider admissible movement....
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 quaternion.
Definition math_functions.h:58
A rigid transform.
Definition math_functions.h:65
A 3D vector.
Definition math_functions.h:41
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
float b3MotorJoint_GetLinearDampingRatio(b3JointId jointId)
Get the spring linear damping ratio.
float b3MotorJoint_GetMaxVelocityForce(b3JointId jointId)
Get the motor joint maximum force, usually in newtons.
void b3MotorJoint_SetAngularVelocity(b3JointId jointId, b3Vec3 velocity)
Set the desired relative angular velocity in radians per second.
b3Vec3 b3MotorJoint_GetAngularVelocity(b3JointId jointId)
Get the desired relative angular velocity in radians per second.
void b3MotorJoint_SetLinearDampingRatio(b3JointId jointId, float damping)
Set the spring linear damping ratio. Use 1.0 for critical damping.
void b3MotorJoint_SetLinearVelocity(b3JointId jointId, b3Vec3 velocity)
Set the desired relative linear velocity in meters per second.
float b3MotorJoint_GetMaxSpringForce(b3JointId jointId)
Get the maximum spring force in newtons.
void b3MotorJoint_SetAngularHertz(b3JointId jointId, float hertz)
Set the spring angular hertz stiffness.
void b3MotorJoint_SetMaxVelocityForce(b3JointId jointId, float maxForce)
Set the motor joint maximum force, usually in newtons.
b3Vec3 b3MotorJoint_GetLinearVelocity(b3JointId jointId)
Get the desired relative linear velocity in meters per second.
float b3MotorJoint_GetMaxVelocityTorque(b3JointId jointId)
Get the motor joint maximum torque, usually in newton-meters.
void b3MotorJoint_SetMaxVelocityTorque(b3JointId jointId, float maxTorque)
Set the motor joint maximum torque, usually in newton-meters.
b3JointId b3CreateMotorJoint(b3WorldId worldId, const b3MotorJointDef *def)
Create a motor joint.
void b3MotorJoint_SetMaxSpringForce(b3JointId jointId, float maxForce)
Set the maximum spring force in newtons.
float b3MotorJoint_GetAngularHertz(b3JointId jointId)
Get the spring angular hertz stiffness.
void b3MotorJoint_SetLinearHertz(b3JointId jointId, float hertz)
Set the spring linear hertz stiffness.
float b3MotorJoint_GetMaxSpringTorque(b3JointId jointId)
Get the maximum spring torque in newtons * meters.
float b3MotorJoint_GetAngularDampingRatio(b3JointId jointId)
Get the spring angular damping ratio.
float b3MotorJoint_GetLinearHertz(b3JointId jointId)
Get the spring linear hertz stiffness.
void b3MotorJoint_SetAngularDampingRatio(b3JointId jointId, float damping)
Set the spring angular damping ratio. Use 1.0 for critical damping.
void b3MotorJoint_SetMaxSpringTorque(b3JointId jointId, float maxTorque)
Set the maximum spring torque in newtons * meters.
A motor joint is used to control the relative position and velocity between two bodies.
Definition types.h:697
void b3ParallelJoint_SetSpringHertz(b3JointId jointId, float hertz)
Set the spring stiffness in Hertz.
void b3ParallelJoint_SetMaxTorque(b3JointId jointId, float force)
Set the maximum spring torque, usually in newton-meters.
b3JointId b3CreateParallelJoint(b3WorldId worldId, const b3ParallelJointDef *def)
Create a parallel joint.
void b3ParallelJoint_SetSpringDampingRatio(b3JointId jointId, float dampingRatio)
Set the spring damping ratio, non-dimensional.
float b3ParallelJoint_GetMaxTorque(b3JointId jointId)
Get the maximum spring torque, usually in newton-meters.
float b3ParallelJoint_GetSpringHertz(b3JointId jointId)
Get the spring Hertz.
float b3ParallelJoint_GetSpringDampingRatio(b3JointId jointId)
Get the spring damping ratio.
Parallel joint definition.
Definition types.h:752
float b3PrismaticJoint_GetMotorSpeed(b3JointId jointId)
Get the prismatic joint motor speed, usually in meters per second.
float b3PrismaticJoint_GetSpeed(b3JointId jointId)
Get the current joint translation speed, usually in meters per second.
float b3PrismaticJoint_GetTargetTranslation(b3JointId jointId)
Get the prismatic joint target translation. Usually in meters.
float b3PrismaticJoint_GetUpperLimit(b3JointId jointId)
Get the prismatic joint upper limit.
void b3PrismaticJoint_SetMotorSpeed(b3JointId jointId, float motorSpeed)
Set the prismatic joint motor speed, usually in meters per second.
bool b3PrismaticJoint_IsLimitEnabled(b3JointId jointId)
Is the prismatic joint limit enabled?
bool b3PrismaticJoint_IsSpringEnabled(b3JointId jointId)
Is the prismatic joint spring enabled or not?
float b3PrismaticJoint_GetSpringHertz(b3JointId jointId)
Get the prismatic joint stiffness in Hertz.
void b3PrismaticJoint_SetMaxMotorForce(b3JointId jointId, float force)
Set the prismatic joint maximum motor force, usually in newtons.
float b3PrismaticJoint_GetSpringDampingRatio(b3JointId jointId)
Get the prismatic spring damping ratio (non-dimensional).
void b3PrismaticJoint_SetSpringHertz(b3JointId jointId, float hertz)
Set the prismatic joint stiffness in Hertz.
void b3PrismaticJoint_SetTargetTranslation(b3JointId jointId, float targetTranslation)
Set the prismatic joint target translation. Usually in meters.
void b3PrismaticJoint_EnableMotor(b3JointId jointId, bool enableMotor)
Enable/disable a prismatic joint motor.
void b3PrismaticJoint_SetLimits(b3JointId jointId, float lower, float upper)
Set the prismatic joint limits.
b3JointId b3CreatePrismaticJoint(b3WorldId worldId, const b3PrismaticJointDef *def)
Create a prismatic (slider) joint.
void b3PrismaticJoint_EnableLimit(b3JointId jointId, bool enableLimit)
Enable/disable a prismatic joint limit.
void b3PrismaticJoint_SetSpringDampingRatio(b3JointId jointId, float dampingRatio)
Set the prismatic joint damping ratio (non-dimensional).
float b3PrismaticJoint_GetMotorForce(b3JointId jointId)
Get the prismatic joint current motor force, usually in newtons.
float b3PrismaticJoint_GetMaxMotorForce(b3JointId jointId)
Get the prismatic joint maximum motor force, usually in newtons.
float b3PrismaticJoint_GetTranslation(b3JointId jointId)
Get the current joint translation, usually in meters.
void b3PrismaticJoint_EnableSpring(b3JointId jointId, bool enableSpring)
Enable/disable the joint spring.
float b3PrismaticJoint_GetLowerLimit(b3JointId jointId)
Get the prismatic joint lower limit.
bool b3PrismaticJoint_IsMotorEnabled(b3JointId jointId)
Is the prismatic joint motor enabled?
Prismatic joint definition.
Definition types.h:776
b3CastOutput b3WorldCastOutput
Same type in single precision.
Definition types.h:1464
Body cast result for ray and shape casts.
Definition types.h:1470
The query filter is used to filter collisions between queries and shapes.
Definition types.h:1284
Result from b3World_RayCastClosest.
Definition types.h:1322
A shape proxy is used by the GJK algorithm. It can represent a convex shape.
Definition types.h:1358
struct b3Recording b3Recording
Opaque recording handle. Create with b3CreateRecording, destroy with b3DestroyRecording.
Definition box3d.h:262
const uint8_t * b3Recording_GetData(const b3Recording *recording)
Get a pointer to the raw recording bytes.
int b3RecPlayer_GetFrameCount(const b3RecPlayer *player)
b3RecPlayerInfo b3RecPlayer_GetInfo(const b3RecPlayer *player)
void b3RecPlayer_SetKeyframePolicy(b3RecPlayer *player, size_t budgetBytes, int minIntervalFrames)
Tune the keyframe ring used to speed up backward seeking.
b3RecPlayer * b3RecPlayer_Create(const void *data, int size, int workerCount)
Create a player over a recording.
b3RecQueryInfo b3RecPlayer_GetFrameQuery(const b3RecPlayer *player, int index)
Get a recorded query from the most recently replayed frame by index.
b3Recording * b3CreateRecording(int byteCapacity)
Create a recording buffer with an optional initial byte capacity.
bool b3RecPlayer_StepFrame(b3RecPlayer *player)
Advance one frame: dispatch ops until the next Step completes.
void b3RecPlayer_SeekFrame(b3RecPlayer *player, int targetFrame)
Seek to a specific frame.
b3Recording * b3LoadRecordingFromFile(const char *path)
Load a recording from a file.
b3RecQueryType
The kind of a recorded spatial query, matching the public query and cast functions.
Definition box3d.h:427
int b3RecPlayer_GetFrameQueryCount(const b3RecPlayer *player)
void b3RecPlayer_Destroy(b3RecPlayer *player)
Destroy the player and free all memory. Restores the previous global length scale.
int b3RecPlayer_GetBodyCount(const b3RecPlayer *player)
void b3RecPlayer_SetWorkerCount(b3RecPlayer *player, int count)
Set the worker count of the replay world.
int b3Recording_GetSize(const b3Recording *recording)
Get the number of bytes currently in the recording buffer.
int b3RecPlayer_GetDivergeFrame(const b3RecPlayer *player)
int b3RecPlayer_GetKeyframeMinInterval(const b3RecPlayer *player)
bool b3ValidateReplay(const void *data, int size, int workerCount)
Replay a recording from memory and verify it reproduces the same world-state hashes.
void b3RecPlayer_SetDebugShapeCallbacks(b3RecPlayer *player, b3CreateDebugShapeCallback *createDebugShape, b3DestroyDebugShapeCallback *destroyDebugShape, void *context)
Wire host debug-shape callbacks into the player's replay world so a renderer can build per-shape draw...
bool b3RecPlayer_IsAtEnd(const b3RecPlayer *player)
struct b3RecPlayer b3RecPlayer
Opaque incremental replay player with a keyframe ring for O(interval) backward seek.
Definition box3d.h:313
b3WorldId b3RecPlayer_GetWorldId(const b3RecPlayer *player)
void b3World_StartRecording(b3WorldId worldId, b3Recording *recording)
Begin recording world mutations into the provided buffer.
bool b3SaveRecordingToFile(const b3Recording *recording, const char *path)
Save the recording buffer to a file.
size_t b3RecPlayer_GetKeyframeBytes(const b3RecPlayer *player)
int b3RecPlayer_GetFrame(const b3RecPlayer *player)
void b3DestroyRecording(b3Recording *recording)
Destroy a recording and free its buffer.
void b3RecPlayer_DrawFrameQueries(b3RecPlayer *player, b3DebugDraw *draw, int queryIndex, int selectedIndex)
Draw the spatial queries recorded during the most recently replayed frame, layered on top of the worl...
b3RecQueryHit b3RecPlayer_GetFrameQueryHit(const b3RecPlayer *player, int queryIndex, int hitIndex)
Get one result of a recorded query from the most recently replayed frame.
size_t b3RecPlayer_GetKeyframeBudget(const b3RecPlayer *player)
int b3RecPlayer_GetKeyframeInterval(const b3RecPlayer *player)
b3BodyId b3RecPlayer_GetBodyId(const b3RecPlayer *player, int index)
Resolve a creation ordinal to the live body id at the current frame.
bool b3RecPlayer_HasDiverged(const b3RecPlayer *player)
void b3World_StopRecording(b3WorldId worldId)
End the current recording session.
void b3RecPlayer_Restart(b3RecPlayer *player)
Rewind to frame 0 (in-place restore so the world id stays stable).
Summary of a recording, read once at open so a viewer can frame and label it.
Definition box3d.h:317
One result of a recorded spatial query.
Definition box3d.h:453
A spatial query recorded during a replayed frame, exposed for inspection.
Definition box3d.h:439
float b3RevoluteJoint_GetLowerLimit(b3JointId jointId)
Get the revolute joint lower limit in radians.
void b3RevoluteJoint_SetSpringDampingRatio(b3JointId jointId, float dampingRatio)
Set the revolute joint spring damping ratio, non-dimensional.
bool b3RevoluteJoint_IsLimitEnabled(b3JointId jointId)
Is the revolute joint limit enabled?
void b3RevoluteJoint_SetMotorSpeed(b3JointId jointId, float motorSpeed)
Set the revolute joint motor speed in radians per second.
float b3RevoluteJoint_GetMotorSpeed(b3JointId jointId)
Get the revolute joint motor speed in radians per second.
bool b3RevoluteJoint_IsMotorEnabled(b3JointId jointId)
Is the revolute joint motor enabled?
void b3RevoluteJoint_SetLimits(b3JointId jointId, float lowerLimitRadians, float upperLimitRadians)
Set the revolute joint limits in radians.
float b3RevoluteJoint_GetTargetAngle(b3JointId jointId)
Get the revolute joint target angle in radians.
float b3RevoluteJoint_GetSpringHertz(b3JointId jointId)
Get the revolute joint spring stiffness in Hertz.
void b3RevoluteJoint_SetSpringHertz(b3JointId jointId, float hertz)
Set the revolute joint spring stiffness in Hertz.
float b3RevoluteJoint_GetMotorTorque(b3JointId jointId)
Get the revolute joint current motor torque, usually in newton-meters.
float b3RevoluteJoint_GetMaxMotorTorque(b3JointId jointId)
Get the revolute joint maximum motor torque, usually in newton-meters.
void b3RevoluteJoint_EnableSpring(b3JointId jointId, bool enableSpring)
Enable/disable the revolute joint spring.
float b3RevoluteJoint_GetSpringDampingRatio(b3JointId jointId)
Get the revolute joint spring damping ratio, non-dimensional.
void b3RevoluteJoint_EnableMotor(b3JointId jointId, bool enableMotor)
Enable/disable a revolute joint motor.
float b3RevoluteJoint_GetAngle(b3JointId jointId)
Get the revolute joint current angle in radians relative to the reference angle.
void b3RevoluteJoint_SetTargetAngle(b3JointId jointId, float targetRadians)
Set the revolute joint target angle in radians.
b3JointId b3CreateRevoluteJoint(b3WorldId worldId, const b3RevoluteJointDef *def)
Create a revolute joint.
void b3RevoluteJoint_SetMaxMotorTorque(b3JointId jointId, float torque)
Set the revolute joint maximum motor torque, usually in newton-meters.
float b3RevoluteJoint_GetUpperLimit(b3JointId jointId)
Get the revolute joint upper limit in radians.
bool b3RevoluteJoint_IsSpringEnabled(b3JointId jointId)
Is the revolute angular spring enabled?
void b3RevoluteJoint_EnableLimit(b3JointId jointId, bool enableLimit)
Enable/disable the revolute joint limit.
Revolute joint definition.
Definition types.h:820
b3ShapeId b3CreateHullShape(b3BodyId bodyId, const b3ShapeDef *def, const b3HullData *hull)
Create a convex hull shape and attach it to a body.
b3Filter b3Shape_GetFilter(b3ShapeId shapeId)
Get the shape filter.
void b3DestroyShape(b3ShapeId shapeId, bool updateBodyMass)
Destroy a shape.
void b3Shape_SetCapsule(b3ShapeId shapeId, const b3Capsule *capsule)
Allows you to change a shape to be a capsule or update the current capsule.
void b3Shape_SetHull(b3ShapeId shapeId, const b3HullData *hull)
Allows you to change a shape to be a hull or update the current hull.
bool b3Shape_AreHitEventsEnabled(b3ShapeId shapeId)
Returns true if hit events are enabled.
b3ShapeId b3CreateCapsuleShape(b3BodyId bodyId, const b3ShapeDef *def, const b3Capsule *capsule)
Create a capsule shape and attach it to a body.
b3AABB b3Shape_GetAABB(b3ShapeId shapeId)
Get the current world AABB.
bool b3Shape_AreContactEventsEnabled(b3ShapeId shapeId)
Returns true if contact events are enabled.
b3WorldId b3Shape_GetWorld(b3ShapeId shapeId)
Get the world that owns this shape.
int b3Shape_GetMeshMaterialCount(b3ShapeId shapeId)
Get the number of mesh surface materials.
b3ShapeId b3CreateSphereShape(b3BodyId bodyId, const b3ShapeDef *def, const b3Sphere *sphere)
Create a circle shape and attach it to a body.
void b3Shape_SetRestitution(b3ShapeId shapeId, float restitution)
Set the shape restitution (bounciness).
void b3Shape_SetFriction(b3ShapeId shapeId, float friction)
Set the friction on a shape.
b3SurfaceMaterial b3Shape_GetMeshSurfaceMaterial(b3ShapeId shapeId, int index)
Get a surface material for a mesh shape.
void b3Shape_EnableHitEvents(b3ShapeId shapeId, bool flag)
Enable contact hit events for this shape.
void b3Shape_EnableContactEvents(b3ShapeId shapeId, bool flag)
Enable contact events for this shape.
b3ShapeId b3CreateTransformedHullShape(b3BodyId bodyId, const b3ShapeDef *def, const b3HullData *hull, b3Transform transform, b3Vec3 scale)
Create a convex hull shape and attach it to a body.
void b3Shape_SetFilter(b3ShapeId shapeId, b3Filter filter, bool invokeContacts)
Set the current filter.
void b3Shape_ApplyWind(b3ShapeId shapeId, b3Vec3 wind, float drag, float lift, float maxSpeed, bool wake)
Apply a wind force to the body for this shape using the density of air.
void b3Shape_SetDensity(b3ShapeId shapeId, float density, bool updateBodyMass)
Set the mass density of a shape, usually in kg/m^3.
b3ShapeId b3CreateMeshShape(b3BodyId bodyId, const b3ShapeDef *def, const b3MeshData *mesh, b3Vec3 scale)
Create a mesh hull shape and attach it to a body.
b3MassData b3Shape_ComputeMassData(b3ShapeId shapeId)
Compute the mass data for a shape.
int b3Shape_GetSensorCapacity(b3ShapeId shapeId)
Get the maximum capacity required for retrieving all the overlapped shapes on a sensor shape.
void b3Shape_SetSurfaceMaterial(b3ShapeId shapeId, b3SurfaceMaterial surfaceMaterial)
Set the shape base surface material. Does not change per triangle materials.
void * b3Shape_GetUserData(b3ShapeId shapeId)
Get the user data for a shape.
bool b3Shape_ArePreSolveEventsEnabled(b3ShapeId shapeId)
Returns true if pre-solve events are enabled.
b3ShapeType
Shape type.
Definition types.h:431
b3SurfaceMaterial b3Shape_GetSurfaceMaterial(b3ShapeId shapeId)
Get the base shape surface material.
float b3Shape_GetFriction(b3ShapeId shapeId)
Get the friction of a shape.
b3BodyId b3Shape_GetBody(b3ShapeId shapeId)
Get the id of the body that a shape is attached to.
const b3HullData * b3Shape_GetHull(b3ShapeId shapeId)
Get the shape's convex hull. Asserts the type is correct.
b3ShapeId b3CreateCompoundShape(b3BodyId bodyId, b3ShapeDef *def, const b3CompoundData *compound)
Compound shapes are only allowed on static bodies.
b3ShapeId b3CreateHeightFieldShape(b3BodyId bodyId, const b3ShapeDef *def, const b3HeightFieldData *heightField)
Create a height-field shape and attach it to a body.
void b3Shape_SetMeshMaterial(b3ShapeId shapeId, b3SurfaceMaterial surfaceMaterial, int index)
Set a surface material for a mesh shape.
int b3Shape_GetContactCapacity(b3ShapeId shapeId)
Get the maximum capacity required for retrieving all the touching contacts on a shape.
b3Mesh b3Shape_GetMesh(b3ShapeId shapeId)
Get the shape's mesh. Asserts the type is correct.
b3WorldCastOutput b3Shape_RayCast(b3ShapeId shapeId, b3Pos origin, b3Vec3 translation)
Ray cast a shape directly.
int b3Shape_GetContactData(b3ShapeId shapeId, b3ContactData *contactData, int capacity)
Get the touching contact data for a shape.
int b3Shape_GetSensorData(b3ShapeId shapeId, b3ShapeId *visitorIds, int capacity)
Get the overlap data for a sensor shape.
void b3Shape_SetMesh(b3ShapeId shapeId, const b3MeshData *meshData, b3Vec3 scale)
Allows you to change a shape to be a mesh or update the current mesh.
bool b3Shape_AreSensorEventsEnabled(b3ShapeId shapeId)
Returns true if sensor events are enabled.
void b3Shape_SetUserData(b3ShapeId shapeId, void *userData)
Set the user data for a shape.
void b3Shape_EnableSensorEvents(b3ShapeId shapeId, bool flag)
Enable sensor events for this shape.
const b3HeightFieldData * b3Shape_GetHeightField(b3ShapeId shapeId)
Get the shape's height field. Asserts the type is correct.
bool b3Shape_IsValid(b3ShapeId id)
Shape identifier validation. Provides validation for up to 64K allocations.
void b3Shape_EnablePreSolveEvents(b3ShapeId shapeId, bool flag)
Enable pre-solve contact events for this shape.
b3ShapeType b3Shape_GetType(b3ShapeId shapeId)
Get the type of a shape.
float b3Shape_GetRestitution(b3ShapeId shapeId)
Get the shape restitution.
b3Vec3 b3Shape_GetClosestPoint(b3ShapeId shapeId, b3Vec3 target)
Get the closest point on a shape to a target point. Target and result are in world space.
void b3Shape_SetSphere(b3ShapeId shapeId, const b3Sphere *sphere)
Allows you to change a shape to be a sphere or update the current sphere.
b3Sphere b3Shape_GetSphere(b3ShapeId shapeId)
Get a copy of the shape's sphere. Asserts the type is correct.
bool b3Shape_IsSensor(b3ShapeId shapeId)
Returns true if the shape is a sensor.
float b3Shape_GetDensity(b3ShapeId shapeId)
Get the density of a shape, usually in kg/m^3.
b3Capsule b3Shape_GetCapsule(b3ShapeId shapeId)
Get a copy of the shape's capsule. Asserts the type is correct.
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
A solid sphere.
Definition types.h:1886
b3Vec3 b3SphericalJoint_GetMotorTorque(b3JointId jointId)
Get the spherical joint current motor torque, usually in newton-meters.
void b3SphericalJoint_SetSpringDampingRatio(b3JointId jointId, float dampingRatio)
Set the spherical joint spring damping ratio, non-dimensional.
void b3SphericalJoint_SetTargetRotation(b3JointId jointId, b3Quat targetRotation)
Set the spherical joint spring target rotation.
float b3SphericalJoint_GetSpringDampingRatio(b3JointId jointId)
Get the spherical joint spring damping ratio, non-dimensional.
bool b3SphericalJoint_IsTwistLimitEnabled(b3JointId jointId)
Is the spherical joint limit enabled?
void b3SphericalJoint_SetTwistLimits(b3JointId jointId, float lowerLimitRadians, float upperLimitRadians)
Set the spherical joint limits in radians.
void b3SphericalJoint_EnableMotor(b3JointId jointId, bool enableMotor)
Enable/disable a spherical joint motor.
void b3SphericalJoint_SetSpringHertz(b3JointId jointId, float hertz)
Set the spherical joint spring stiffness in Hertz.
b3JointId b3CreateSphericalJoint(b3WorldId worldId, const b3SphericalJointDef *def)
Create a spherical joint.
b3Vec3 b3SphericalJoint_GetMotorVelocity(b3JointId jointId)
Get the spherical joint motor velocity in radians per second.
void b3SphericalJoint_EnableTwistLimit(b3JointId jointId, bool enableLimit)
Enable/disable the spherical joint limit.
void b3SphericalJoint_SetMaxMotorTorque(b3JointId jointId, float torque)
Set the spherical joint maximum motor torque, usually in newton-meters.
bool b3SphericalJoint_IsMotorEnabled(b3JointId jointId)
Is the spherical joint motor enabled?
float b3SphericalJoint_GetConeAngle(b3JointId jointId)
Get the spherical joint current cone angle in radians.
float b3SphericalJoint_GetConeLimit(b3JointId jointId)
Get the spherical joint cone limit in radians.
float b3SphericalJoint_GetLowerTwistLimit(b3JointId jointId)
Get the spherical joint lower limit in radians.
void b3SphericalJoint_EnableSpring(b3JointId jointId, bool enableSpring)
Enable/disable the spherical joint spring.
float b3SphericalJoint_GetTwistAngle(b3JointId jointId)
Get the spherical joint current twist angle in radians.
void b3SphericalJoint_SetConeLimit(b3JointId jointId, float angleRadians)
Set the spherical joint limits in radians.
float b3SphericalJoint_GetUpperTwistLimit(b3JointId jointId)
Get the spherical joint upper limit in radians.
float b3SphericalJoint_GetMaxMotorTorque(b3JointId jointId)
Get the spherical joint maximum motor torque, usually in newton-meters.
void b3SphericalJoint_SetMotorVelocity(b3JointId jointId, b3Vec3 motorVelocity)
Set the spherical joint motor velocity in radians per second.
float b3SphericalJoint_GetSpringHertz(b3JointId jointId)
Get the spherical joint spring stiffness in Hertz.
bool b3SphericalJoint_IsSpringEnabled(b3JointId jointId)
Is the spherical angular spring enabled?
bool b3SphericalJoint_IsConeLimitEnabled(b3JointId jointId)
Is the spherical joint cone limit enabled?
void b3SphericalJoint_EnableConeLimit(b3JointId jointId, bool enableLimit)
Enable/disable the spherical joint cone limit.
b3Quat b3SphericalJoint_GetTargetRotation(b3JointId jointId)
Get the spherical joint spring target rotation.
Spherical joint definition.
Definition types.h:864
These are performance results returned by dynamic tree queries.
Definition types.h:1760
float b3WeldJoint_GetAngularDampingRatio(b3JointId jointId)
Get the weld joint angular damping ratio, non-dimensional.
void b3WeldJoint_SetLinearHertz(b3JointId jointId, float hertz)
Set the weld joint linear stiffness in Hertz. 0 is rigid.
float b3WeldJoint_GetLinearHertz(b3JointId jointId)
Get the weld joint linear stiffness in Hertz.
float b3WeldJoint_GetAngularHertz(b3JointId jointId)
Get the weld joint angular stiffness in Hertz.
void b3WeldJoint_SetAngularHertz(b3JointId jointId, float hertz)
Set the weld joint angular stiffness in Hertz. 0 is rigid.
void b3WeldJoint_SetLinearDampingRatio(b3JointId jointId, float dampingRatio)
Set the weld joint linear damping ratio (non-dimensional).
float b3WeldJoint_GetLinearDampingRatio(b3JointId jointId)
Get the weld joint linear damping ratio (non-dimensional).
void b3WeldJoint_SetAngularDampingRatio(b3JointId jointId, float dampingRatio)
Set weld joint angular damping ratio, non-dimensional.
b3JointId b3CreateWeldJoint(b3WorldId worldId, const b3WeldJointDef *def)
Create a weld joint.
Weld joint definition Connects two bodies together rigidly.
Definition types.h:916
void b3WheelJoint_EnableSpinMotor(b3JointId jointId, bool flag)
Enable/disable the wheel joint motor.
float b3WheelJoint_GetUpperSuspensionLimit(b3JointId jointId)
Get the wheel joint upper limit.
float b3WheelJoint_GetSuspensionDampingRatio(b3JointId jointId)
Get the wheel joint damping ratio, non-dimensional.
b3JointId b3CreateWheelJoint(b3WorldId worldId, const b3WheelJointDef *def)
Create a wheel joint.
void b3WheelJoint_SetSuspensionLimits(b3JointId jointId, float lower, float upper)
Set the wheel joint limits.
bool b3WheelJoint_IsSteeringEnabled(b3JointId jointId)
Can the wheel steer?
void b3WheelJoint_SetSuspensionHertz(b3JointId jointId, float hertz)
Set the wheel joint stiffness in Hertz.
bool b3WheelJoint_IsSpinMotorEnabled(b3JointId jointId)
Is the wheel joint motor enabled?
float b3WheelJoint_GetSteeringHertz(b3JointId jointId)
Get the wheel joint steering stiffness in Hertz.
void b3WheelJoint_EnableSuspensionLimit(b3JointId jointId, bool flag)
Enable/disable the wheel joint limit.
float b3WheelJoint_GetTargetSteeringAngle(b3JointId jointId)
Get the wheel joint target steering angle in radians.
float b3WheelJoint_GetLowerSteeringLimit(b3JointId jointId)
Get the wheel joint lower steering limit in radians.
bool b3WheelJoint_IsSuspensionLimitEnabled(b3JointId jointId)
Is the wheel joint limit enabled?
bool b3WheelJoint_IsSuspensionEnabled(b3JointId jointId)
Is the wheel joint spring enabled?
void b3WheelJoint_SetSteeringHertz(b3JointId jointId, float hertz)
Set the wheel joint steering stiffness in Hertz.
bool b3WheelJoint_IsSteeringLimitEnabled(b3JointId jointId)
Is the wheel joint steering limit enabled?
void b3WheelJoint_SetMaxSteeringTorque(b3JointId jointId, float torque)
Set the wheel joint maximum steering torque in N*m.
void b3WheelJoint_SetTargetSteeringAngle(b3JointId jointId, float radians)
Set the wheel joint target steering angle in radians.
void b3WheelJoint_SetSuspensionDampingRatio(b3JointId jointId, float dampingRatio)
Set the wheel joint damping ratio, non-dimensional.
float b3WheelJoint_GetSuspensionHertz(b3JointId jointId)
Get the wheel joint stiffness in Hertz.
void b3WheelJoint_SetSteeringDampingRatio(b3JointId jointId, float dampingRatio)
Set the wheel joint steering damping ratio, non-dimensional.
void b3WheelJoint_SetSpinMotorSpeed(b3JointId jointId, float speed)
Set the wheel joint motor speed in radians per second.
float b3WheelJoint_GetMaxSpinTorque(b3JointId jointId)
Get the wheel joint maximum motor torque, usually in newton-meters.
float b3WheelJoint_GetLowerSuspensionLimit(b3JointId jointId)
Get the wheel joint lower limit.
void b3WheelJoint_SetMaxSpinTorque(b3JointId jointId, float torque)
Set the wheel joint maximum motor torque, usually in newton-meters.
float b3WheelJoint_GetSpinTorque(b3JointId jointId)
Get the wheel joint current motor torque, usually in newton-meters.
float b3WheelJoint_GetSteeringTorque(b3JointId jointId)
Get the current steering torque in N*m.
float b3WheelJoint_GetUpperSteeringLimit(b3JointId jointId)
Get the wheel joint upper steering limit in radians.
float b3WheelJoint_GetMaxSteeringTorque(b3JointId jointId)
Get the wheel joint maximum steering torque in N*m.
void b3WheelJoint_EnableSteering(b3JointId jointId, bool flag)
Enable/disable wheel steering. Steering allows the wheel to rotate about the suspension axis.
void b3WheelJoint_EnableSuspension(b3JointId jointId, bool flag)
Enable/disable the wheel joint spring.
float b3WheelJoint_GetSteeringDampingRatio(b3JointId jointId)
Get the wheel joint steering damping ratio, non-dimensional.
float b3WheelJoint_GetSpinMotorSpeed(b3JointId jointId)
Get the wheel joint motor speed in radians per second.
float b3WheelJoint_GetSpinSpeed(b3JointId jointId)
Get the current spin speed in radians per second.
float b3WheelJoint_GetSteeringAngle(b3JointId jointId)
Get the current steering angle in radians.
void b3WheelJoint_SetSteeringLimits(b3JointId jointId, float lowerRadians, float upperRadians)
Set the wheel joint steering limits in radians.
void b3WheelJoint_EnableSteeringLimit(b3JointId jointId, bool flag)
Enable/disable the wheel joint steering limit.
Wheel joint definition Body A is the chassis and body B is the wheel.
Definition types.h:944
float b3World_GetRestitutionThreshold(b3WorldId worldId)
Get the restitution speed threshold. Usually in meters per second.
void b3World_SetRestitutionCallback(b3WorldId worldId, b3RestitutionCallback *callback)
Set the restitution callback. Passing NULL resets to default.
void b3World_SetMaximumLinearSpeed(b3WorldId worldId, float maximumLinearSpeed)
Set the maximum linear speed. Usually in m/s.
void b3World_Draw(b3WorldId worldId, b3DebugDraw *draw, uint64_t maskBits)
Call this to draw shapes and other debug draw data.
bool b3PreSolveFcn(b3ShapeId shapeIdA, b3ShapeId shapeIdB, b3Pos point, b3Vec3 normal, void *context)
Prototype for a pre-solve callback.
Definition types.h:88
void b3World_SetPreSolveCallback(b3WorldId worldId, b3PreSolveFcn *fcn, void *context)
Register the pre-solve callback. This is optional.
void b3World_SetHitEventThreshold(b3WorldId worldId, float value)
Adjust the hit event threshold.
b3Vec3 b3World_GetGravity(b3WorldId worldId)
Get the gravity vector.
b3Capacity b3World_GetMaxCapacity(b3WorldId worldId)
Get max capacity. This can be used with b3WorldDef to avoid run-time allocations and copies.
void b3World_CollideMover(b3WorldId worldId, b3Pos origin, const b3Capsule *mover, b3QueryFilter filter, b3PlaneResultFcn *fcn, void *context)
Collide a capsule mover with the world, gathering collision planes that can be fed to b3SolvePlanes.
float b3World_CastMover(b3WorldId worldId, b3Pos origin, const b3Capsule *mover, b3Vec3 translation, b3QueryFilter filter, b3MoverFilterFcn *fcn, void *context)
Cast a capsule mover through the world.
b3TreeStats b3World_OverlapShape(b3WorldId worldId, b3Pos origin, const b3ShapeProxy *proxy, b3QueryFilter filter, b3OverlapResultFcn *fcn, void *context)
Overlap test for all shapes that overlap the provided shape proxy.
void b3World_SetContactTuning(b3WorldId worldId, float hertz, float dampingRatio, float contactSpeed)
Adjust contact tuning parameters.
void b3World_Dump(b3WorldId worldId)
Dump world to a text file. Meshes are saved to binary b3m files.
int b3World_GetWorkerCount(b3WorldId worldId)
Get the worker count.
bool b3CustomFilterFcn(b3ShapeId shapeIdA, b3ShapeId shapeIdB, void *context)
Prototype for a contact filter callback.
Definition types.h:73
b3RayResult b3World_CastRayClosest(b3WorldId worldId, b3Pos origin, b3Vec3 translation, b3QueryFilter filter)
Cast a ray into the world to collect the closest hit.
float b3World_GetHitEventThreshold(b3WorldId worldId)
Get the hit event speed threshold. Usually in meters per second.
b3WorldId b3CreateWorld(const b3WorldDef *def)
Create a world for rigid body simulation.
bool b3World_IsSleepingEnabled(b3WorldId worldId)
Is body sleeping enabled?
void b3World_EnableContinuous(b3WorldId worldId, bool flag)
Enable/disable continuous collision between dynamic and static bodies.
void b3World_RebuildStaticTree(b3WorldId worldId)
This is for internal testing.
void b3World_SetContactRecycleDistance(b3WorldId worldId, float recycleDistance)
Set the contact point recycling distance.
bool b3World_IsContinuousEnabled(b3WorldId worldId)
Is continuous collision enabled?
b3BodyEvents b3World_GetBodyEvents(b3WorldId worldId)
Get the body events for the current time step. The event data is transient. Do not store a reference ...
float b3FrictionCallback(float frictionA, uint64_t userMaterialIdA, float frictionB, uint64_t userMaterialIdB)
Optional friction mixing callback.
Definition types.h:54
void b3World_SetCustomFilterCallback(b3WorldId worldId, b3CustomFilterFcn *fcn, void *context)
Register the custom filter callback. This is optional.
void b3World_EnableSpeculative(b3WorldId worldId, bool flag)
This is for internal testing.
bool b3World_IsWarmStartingEnabled(b3WorldId worldId)
Is constraint warm starting enabled?
b3JointEvents b3World_GetJointEvents(b3WorldId worldId)
Get the joint events for the current time step. The event data is transient. Do not store a reference...
float b3RestitutionCallback(float restitutionA, uint64_t userMaterialIdA, float restitutionB, uint64_t userMaterialIdB)
Optional restitution mixing callback.
Definition types.h:60
b3Counters b3World_GetCounters(b3WorldId worldId)
Get world counters and sizes.
float b3World_GetContactRecycleDistance(b3WorldId worldId)
Get the contact point recycling distance. Usually in meters.
void b3World_SetGravity(b3WorldId worldId, b3Vec3 gravity)
Set the gravity vector for the entire world.
bool b3OverlapResultFcn(b3ShapeId shapeId, void *context)
Prototype callback for overlap queries.
Definition types.h:95
b3ContactEvents b3World_GetContactEvents(b3WorldId worldId)
Get contact events for this current time step. The event data is transient. Do not store a reference ...
void b3DestroyWorld(b3WorldId worldId)
Destroy a world.
b3AABB b3World_GetBounds(b3WorldId worldId)
Get the world's bounds.
void b3World_SetWorkerCount(b3WorldId worldId, int count)
Set the worker count. Must be in the range [1, B3_MAX_WORKERS].
void b3World_Explode(b3WorldId worldId, const b3ExplosionDef *explosionDef)
Apply a radial explosion.
bool b3World_IsValid(b3WorldId id)
World id validation. Provides validation for up to 64K allocations.
b3TreeStats b3World_CastRay(b3WorldId worldId, b3Pos origin, b3Vec3 translation, b3QueryFilter filter, b3CastResultFcn *fcn, void *context)
Cast a ray into the world to collect shapes in the path of the ray.
float b3World_GetMaximumLinearSpeed(b3WorldId worldId)
Get the maximum linear speed. Usually in m/s.
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
b3Profile b3World_GetProfile(b3WorldId worldId)
Get the current world performance profile.
void * b3World_GetUserData(b3WorldId worldId)
Get the user data pointer.
b3TreeStats b3World_OverlapAABB(b3WorldId worldId, b3AABB aabb, b3QueryFilter filter, b3OverlapResultFcn *fcn, void *context)
Overlap test for all shapes that potentially overlap the provided AABB.
void b3World_SetFrictionCallback(b3WorldId worldId, b3FrictionCallback *callback)
Set the friction callback. Passing NULL resets to default.
void b3World_SetUserData(b3WorldId worldId, void *userData)
Set the user data pointer.
void b3World_DumpAwake(b3WorldId worldId)
Dump world to a text file.
int b3GetMaxWorldCount(void)
Get the maximum number of simultaneous worlds that have been created.
void b3World_EnableWarmStarting(b3WorldId worldId, bool flag)
Enable/disable constraint warm starting.
void b3World_SetRestitutionThreshold(b3WorldId worldId, float value)
Adjust the restitution threshold.
int b3GetWorldCount(void)
Get the current number of worlds.
void b3World_DumpMemoryStats(b3WorldId worldId)
Dump memory stats to log.
void b3World_EnableSleeping(b3WorldId worldId, bool flag)
Enable/disable sleep.
int b3World_GetAwakeBodyCount(b3WorldId worldId)
Get the number of awake bodies.
void b3World_DumpShapeBounds(b3WorldId worldId, b3BodyType type)
Dump shape bounds to box3d_bounds.txt.
b3TreeStats b3World_CastShape(b3WorldId worldId, b3Pos origin, const b3ShapeProxy *proxy, b3Vec3 translation, b3QueryFilter filter, b3CastResultFcn *fcn, void *context)
Cast a shape through the world.
void b3World_Step(b3WorldId worldId, float timeStep, int subStepCount)
Simulate a world for one time step.
b3SensorEvents b3World_GetSensorEvents(b3WorldId worldId)
Get sensor events for the current time step. The event data is transient. Do not store a reference to...
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
This struct is passed to b3World_Draw to draw a debug view of the simulation world.
Definition types.h:2948