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
346
348B3_API void b3RecPlayer_Restart( b3RecPlayer* player );
349
352B3_API void b3RecPlayer_SeekFrame( b3RecPlayer* player, int targetFrame );
353
356
358B3_API int b3RecPlayer_GetFrame( const b3RecPlayer* player );
359
361B3_API int b3RecPlayer_GetFrameCount( const b3RecPlayer* player );
362
364B3_API bool b3RecPlayer_IsAtEnd( const b3RecPlayer* player );
365
367B3_API bool b3RecPlayer_IsAtPreStep( const b3RecPlayer* player );
368
370B3_API bool b3RecPlayer_HasDiverged( const b3RecPlayer* player );
371
374
376B3_API int b3RecPlayer_GetDivergeFrame( const b3RecPlayer* player );
377
382B3_API void b3RecPlayer_SetWorkerCount( b3RecPlayer* player, int count );
383
391B3_API void b3RecPlayer_SetKeyframePolicy( b3RecPlayer* player, size_t budgetBytes, int minIntervalFrames );
392
394B3_API size_t b3RecPlayer_GetKeyframeBudget( const b3RecPlayer* player );
395
398
402
404B3_API size_t b3RecPlayer_GetKeyframeBytes( const b3RecPlayer* player );
405
407B3_API int b3RecPlayer_GetBodyCount( const b3RecPlayer* player );
408
411B3_API b3BodyId b3RecPlayer_GetBodyId( const b3RecPlayer* player, int index );
412
423 b3DestroyDebugShapeCallback* destroyDebugShape, void* context );
424
431B3_API void b3RecPlayer_DrawFrameQueries( b3RecPlayer* player, b3DebugDraw* draw, int queryIndex, int selectedIndex );
432
434typedef enum b3RecQueryType
435{
436 b3_recQueryOverlapAABB,
437 b3_recQueryOverlapShape,
438 b3_recQueryCastRay,
439 b3_recQueryCastShape,
440 b3_recQueryCastRayClosest,
441 b3_recQueryCastMover,
442 b3_recQueryCollideMover,
444
446typedef struct b3RecQueryInfo
447{
448 b3RecQueryType type;
449 b3QueryFilter filter;
450 b3AABB aabb; // world-space bounds of the query, swept for casts
451 b3Pos origin; // query origin (zero for overlap AABB)
452 b3Vec3 translation; // ray and cast translation
453 int hitCount; // number of recorded results
454 uint64_t key; // identity key, the hash of (id, name), 0 if untagged
455 uint64_t id; // query id, 0 if none
456 const char* name; // query label, NULL if none
458
460typedef struct b3RecQueryHit
461{
462 b3ShapeId shape;
463 b3Pos point;
464 b3Vec3 normal;
465 float fraction;
467
469B3_API int b3RecPlayer_GetFrameQueryCount( const b3RecPlayer* player );
470
472B3_API b3RecQueryInfo b3RecPlayer_GetFrameQuery( const b3RecPlayer* player, int index );
473
475B3_API b3RecQueryHit b3RecPlayer_GetFrameQueryHit( const b3RecPlayer* player, int queryIndex, int hitIndex );
476 // recording
478 // world
480
486
494B3_API b3BodyId b3CreateBody( b3WorldId worldId, const b3BodyDef* def );
495
498B3_API void b3DestroyBody( b3BodyId bodyId );
499
502B3_API bool b3Body_IsValid( b3BodyId id );
503
506
509B3_API void b3Body_SetType( b3BodyId bodyId, b3BodyType type );
510
512B3_API void b3Body_SetName( b3BodyId bodyId, const char* name );
513
515B3_API const char* b3Body_GetName( b3BodyId bodyId );
516
518B3_API void b3Body_SetUserData( b3BodyId bodyId, void* userData );
519
521B3_API void* b3Body_GetUserData( b3BodyId bodyId );
522
525
528
531
535B3_API void b3Body_SetTransform( b3BodyId bodyId, b3Pos position, b3Quat rotation );
536
538B3_API b3Vec3 b3Body_GetLocalPoint( b3BodyId bodyId, b3Pos worldPoint );
539
541B3_API b3Pos b3Body_GetWorldPoint( b3BodyId bodyId, b3Vec3 localPoint );
542
544B3_API b3Vec3 b3Body_GetLocalVector( b3BodyId bodyId, b3Vec3 worldVector );
545
547B3_API b3Vec3 b3Body_GetWorldVector( b3BodyId bodyId, b3Vec3 localVector );
548
551
554
556B3_API void b3Body_SetLinearVelocity( b3BodyId bodyId, b3Vec3 linearVelocity );
557
559B3_API void b3Body_SetAngularVelocity( b3BodyId bodyId, b3Vec3 angularVelocity );
560
565B3_API void b3Body_SetTargetTransform( b3BodyId bodyId, b3WorldTransform target, float timeStep, bool wake );
566
569
572
580B3_API void b3Body_ApplyForce( b3BodyId bodyId, b3Vec3 force, b3Pos point, bool wake );
581
587B3_API void b3Body_ApplyForceToCenter( b3BodyId bodyId, b3Vec3 force, bool wake );
588
594B3_API void b3Body_ApplyTorque( b3BodyId bodyId, b3Vec3 torque, bool wake );
595
606B3_API void b3Body_ApplyLinearImpulse( b3BodyId bodyId, b3Vec3 impulse, b3Pos point, bool wake );
607
615B3_API void b3Body_ApplyLinearImpulseToCenter( b3BodyId bodyId, b3Vec3 impulse, bool wake );
616
624B3_API void b3Body_ApplyAngularImpulse( b3BodyId bodyId, b3Vec3 impulse, bool wake );
625
627B3_API float b3Body_GetMass( b3BodyId bodyId );
628
631
633B3_API float b3Body_GetInverseMass( b3BodyId bodyId );
634
637
640
643
647B3_API void b3Body_SetMassData( b3BodyId bodyId, b3MassData massData );
648
651
658
660B3_API void b3Body_SetLinearDamping( b3BodyId bodyId, float linearDamping );
661
663B3_API float b3Body_GetLinearDamping( b3BodyId bodyId );
664
666B3_API void b3Body_SetAngularDamping( b3BodyId bodyId, float angularDamping );
667
669B3_API float b3Body_GetAngularDamping( b3BodyId bodyId );
670
673B3_API void b3Body_SetGravityScale( b3BodyId bodyId, float gravityScale );
674
676B3_API float b3Body_GetGravityScale( b3BodyId bodyId );
677
679B3_API bool b3Body_IsAwake( b3BodyId bodyId );
680
684B3_API void b3Body_SetAwake( b3BodyId bodyId, bool awake );
685
687B3_API void b3Body_EnableSleep( b3BodyId bodyId, bool enableSleep );
688
690B3_API bool b3Body_IsSleepEnabled( b3BodyId bodyId );
691
693B3_API void b3Body_SetSleepThreshold( b3BodyId bodyId, float sleepThreshold );
694
696B3_API float b3Body_GetSleepThreshold( b3BodyId bodyId );
697
699B3_API bool b3Body_IsEnabled( b3BodyId bodyId );
700
702B3_API void b3Body_Disable( b3BodyId bodyId );
703
705B3_API void b3Body_Enable( b3BodyId bodyId );
706
708B3_API void b3Body_SetMotionLocks( b3BodyId bodyId, b3MotionLocks locks );
709
712
715B3_API void b3Body_SetBullet( b3BodyId bodyId, bool flag );
716
718B3_API bool b3Body_IsBullet( b3BodyId bodyId );
719
725B3_API void b3Body_EnableContactRecycling( b3BodyId bodyId, bool flag );
726
729
732B3_API void b3Body_EnableHitEvents( b3BodyId bodyId, bool enableHitEvents );
733
736
738B3_API int b3Body_GetShapeCount( b3BodyId bodyId );
739
742B3_API int b3Body_GetShapes( b3BodyId bodyId, b3ShapeId* shapeArray, int capacity );
743
745B3_API int b3Body_GetJointCount( b3BodyId bodyId );
746
749B3_API int b3Body_GetJoints( b3BodyId bodyId, b3JointId* jointArray, int capacity );
750
753
755B3_API int b3Body_GetContactData( b3BodyId bodyId, b3ContactData* contactData, int capacity );
756
760
762B3_API float b3Body_GetClosestPoint( b3BodyId bodyId, b3Vec3* result, b3Vec3 target );
763
765B3_API b3BodyCastResult b3Body_CastRay( b3BodyId bodyId, b3Pos origin, b3Vec3 translation, b3QueryFilter filter,
766 float maxFraction, b3WorldTransform bodyTransform );
767
769B3_API b3BodyCastResult b3Body_CastShape( b3BodyId bodyId, b3Pos origin, const b3ShapeProxy* proxy, b3Vec3 translation,
770 b3QueryFilter filter, float maxFraction, bool canEncroach,
771 b3WorldTransform bodyTransform );
772
774B3_API bool b3Body_OverlapShape( b3BodyId bodyId, b3Pos origin, const b3ShapeProxy* proxy, b3QueryFilter filter,
775 b3WorldTransform bodyTransform );
776
778B3_API int b3Body_CollideMover( b3BodyId bodyId, b3BodyPlaneResult* bodyPlanes, int planeCapacity, b3Pos origin,
779 const b3Capsule* mover, b3QueryFilter filter, b3WorldTransform bodyTransform );
780 // body
782
789
793B3_API b3ShapeId b3CreateSphereShape( b3BodyId bodyId, const b3ShapeDef* def, const b3Sphere* sphere );
794
798B3_API b3ShapeId b3CreateCapsuleShape( b3BodyId bodyId, const b3ShapeDef* def, const b3Capsule* capsule );
799
803B3_API b3ShapeId b3CreateHullShape( b3BodyId bodyId, const b3ShapeDef* def, const b3HullData* hull );
804
810 b3Transform transform, b3Vec3 scale );
811
817B3_API b3ShapeId b3CreateMeshShape( b3BodyId bodyId, const b3ShapeDef* def, const b3MeshData* mesh, b3Vec3 scale );
818
824B3_API b3ShapeId b3CreateHeightFieldShape( b3BodyId bodyId, const b3ShapeDef* def, const b3HeightFieldData* heightField );
825
827B3_API b3ShapeId b3CreateCompoundShape( b3BodyId bodyId, b3ShapeDef* def, const b3CompoundData* compound );
828
832B3_API void b3DestroyShape( b3ShapeId shapeId, bool updateBodyMass );
833
835B3_API bool b3Shape_IsValid( b3ShapeId id );
836
839
842
845
847B3_API bool b3Shape_IsSensor( b3ShapeId shapeId );
848
850B3_API void b3Shape_SetUserData( b3ShapeId shapeId, void* userData );
851
854B3_API void* b3Shape_GetUserData( b3ShapeId shapeId );
855
859B3_API void b3Shape_SetDensity( b3ShapeId shapeId, float density, bool updateBodyMass );
860
862B3_API float b3Shape_GetDensity( b3ShapeId shapeId );
863
865B3_API void b3Shape_SetFriction( b3ShapeId shapeId, float friction );
866
868B3_API float b3Shape_GetFriction( b3ShapeId shapeId );
869
871B3_API void b3Shape_SetRestitution( b3ShapeId shapeId, float restitution );
872
874B3_API float b3Shape_GetRestitution( b3ShapeId shapeId );
875
877B3_API void b3Shape_SetSurfaceMaterial( b3ShapeId shapeId, b3SurfaceMaterial surfaceMaterial );
878
881
884
886B3_API void b3Shape_SetMeshMaterial( b3ShapeId shapeId, b3SurfaceMaterial surfaceMaterial, int index );
887
890
893
899B3_API void b3Shape_SetFilter( b3ShapeId shapeId, b3Filter filter, bool invokeContacts );
900
903B3_API void b3Shape_EnableSensorEvents( b3ShapeId shapeId, bool flag );
904
907
910B3_API void b3Shape_EnableContactEvents( b3ShapeId shapeId, bool flag );
911
914
918B3_API void b3Shape_EnablePreSolveEvents( b3ShapeId shapeId, bool flag );
919
922
925B3_API void b3Shape_EnableHitEvents( b3ShapeId shapeId, bool flag );
926
929
932B3_API b3WorldCastOutput b3Shape_RayCast( b3ShapeId shapeId, b3Pos origin, b3Vec3 translation );
933
936
939
941B3_API const b3HullData* b3Shape_GetHull( b3ShapeId shapeId );
942
945
948
952B3_API void b3Shape_SetSphere( b3ShapeId shapeId, const b3Sphere* sphere );
953
957B3_API void b3Shape_SetCapsule( b3ShapeId shapeId, const b3Capsule* capsule );
958
962B3_API void b3Shape_SetHull( b3ShapeId shapeId, const b3HullData* hull );
963
967B3_API void b3Shape_SetMesh( b3ShapeId shapeId, const b3MeshData* meshData, b3Vec3 scale );
968
971
976B3_API int b3Shape_GetContactData( b3ShapeId shapeId, b3ContactData* contactData, int capacity );
977
983
991B3_API int b3Shape_GetSensorData( b3ShapeId shapeId, b3ShapeId* visitorIds, int capacity );
992
995
998
1001
1011B3_API void b3Shape_ApplyWind( b3ShapeId shapeId, b3Vec3 wind, float drag, float lift, float maxSpeed, bool wake );
1012 // shape
1014
1020
1022B3_API void b3DestroyJoint( b3JointId jointId, bool wakeAttached );
1023
1025B3_API bool b3Joint_IsValid( b3JointId id );
1026
1029
1032
1035
1038
1040B3_API void b3Joint_SetLocalFrameA( b3JointId jointId, b3Transform localFrame );
1041
1044
1046B3_API void b3Joint_SetLocalFrameB( b3JointId jointId, b3Transform localFrame );
1047
1050
1052B3_API void b3Joint_SetCollideConnected( b3JointId jointId, bool shouldCollide );
1053
1056
1058B3_API void b3Joint_SetUserData( b3JointId jointId, void* userData );
1059
1061B3_API void* b3Joint_GetUserData( b3JointId jointId );
1062
1064B3_API void b3Joint_WakeBodies( b3JointId jointId );
1065
1068
1071
1074
1077
1082B3_API void b3Joint_SetConstraintTuning( b3JointId jointId, float hertz, float dampingRatio );
1083
1085B3_API void b3Joint_GetConstraintTuning( b3JointId jointId, float* hertz, float* dampingRatio );
1086
1088B3_API void b3Joint_SetForceThreshold( b3JointId jointId, float threshold );
1089
1091B3_API float b3Joint_GetForceThreshold( b3JointId jointId );
1092
1094B3_API void b3Joint_SetTorqueThreshold( b3JointId jointId, float threshold );
1095
1098
1104
1108
1110B3_API void b3ParallelJoint_SetSpringHertz( b3JointId jointId, float hertz );
1111
1113B3_API void b3ParallelJoint_SetSpringDampingRatio( b3JointId jointId, float dampingRatio );
1114
1117
1120
1122B3_API void b3ParallelJoint_SetMaxTorque( b3JointId jointId, float force );
1123
1126 // parallel_joint
1128
1134
1138
1142B3_API void b3DistanceJoint_SetLength( b3JointId jointId, float length );
1143
1145B3_API float b3DistanceJoint_GetLength( b3JointId jointId );
1146
1148B3_API void b3DistanceJoint_EnableSpring( b3JointId jointId, bool enableSpring );
1149
1152
1154B3_API void b3DistanceJoint_SetSpringForceRange( b3JointId jointId, float lowerForce, float upperForce );
1155
1157B3_API void b3DistanceJoint_GetSpringForceRange( b3JointId jointId, float* lowerForce, float* upperForce );
1158
1160B3_API void b3DistanceJoint_SetSpringHertz( b3JointId jointId, float hertz );
1161
1163B3_API void b3DistanceJoint_SetSpringDampingRatio( b3JointId jointId, float dampingRatio );
1164
1167
1170
1173B3_API void b3DistanceJoint_EnableLimit( b3JointId jointId, bool enableLimit );
1174
1177
1179B3_API void b3DistanceJoint_SetLengthRange( b3JointId jointId, float minLength, float maxLength );
1180
1183
1186
1189
1191B3_API void b3DistanceJoint_EnableMotor( b3JointId jointId, bool enableMotor );
1192
1195
1197B3_API void b3DistanceJoint_SetMotorSpeed( b3JointId jointId, float motorSpeed );
1198
1201
1203B3_API void b3DistanceJoint_SetMaxMotorForce( b3JointId jointId, float force );
1204
1207
1210 // distance_joint
1212
1224
1228
1230B3_API void b3MotorJoint_SetLinearVelocity( b3JointId jointId, b3Vec3 velocity );
1231
1234
1236B3_API void b3MotorJoint_SetAngularVelocity( b3JointId jointId, b3Vec3 velocity );
1237
1240
1242B3_API void b3MotorJoint_SetMaxVelocityForce( b3JointId jointId, float maxForce );
1243
1246
1248B3_API void b3MotorJoint_SetMaxVelocityTorque( b3JointId jointId, float maxTorque );
1249
1252
1254B3_API void b3MotorJoint_SetLinearHertz( b3JointId jointId, float hertz );
1255
1258
1260B3_API void b3MotorJoint_SetLinearDampingRatio( b3JointId jointId, float damping );
1261
1264
1266B3_API void b3MotorJoint_SetAngularHertz( b3JointId jointId, float hertz );
1267
1270
1272B3_API void b3MotorJoint_SetAngularDampingRatio( b3JointId jointId, float damping );
1273
1276
1278B3_API void b3MotorJoint_SetMaxSpringForce( b3JointId jointId, float maxForce );
1279
1282
1284B3_API void b3MotorJoint_SetMaxSpringTorque( b3JointId jointId, float maxTorque );
1285
1288 // motor_joint
1290
1299
1303 // filter_joint
1305
1314
1318
1320B3_API void b3PrismaticJoint_EnableSpring( b3JointId jointId, bool enableSpring );
1321
1324
1328B3_API void b3PrismaticJoint_SetSpringHertz( b3JointId jointId, float hertz );
1329
1332
1334B3_API void b3PrismaticJoint_SetSpringDampingRatio( b3JointId jointId, float dampingRatio );
1335
1338
1340B3_API void b3PrismaticJoint_SetTargetTranslation( b3JointId jointId, float targetTranslation );
1341
1344
1346B3_API void b3PrismaticJoint_EnableLimit( b3JointId jointId, bool enableLimit );
1347
1350
1353
1356
1358B3_API void b3PrismaticJoint_SetLimits( b3JointId jointId, float lower, float upper );
1359
1361B3_API void b3PrismaticJoint_EnableMotor( b3JointId jointId, bool enableMotor );
1362
1365
1367B3_API void b3PrismaticJoint_SetMotorSpeed( b3JointId jointId, float motorSpeed );
1368
1371
1373B3_API void b3PrismaticJoint_SetMaxMotorForce( b3JointId jointId, float force );
1374
1377
1380
1383
1385B3_API float b3PrismaticJoint_GetSpeed( b3JointId jointId );
1386 // prismatic_joint
1388
1396
1400
1402B3_API void b3RevoluteJoint_EnableSpring( b3JointId jointId, bool enableSpring );
1403
1406
1408B3_API void b3RevoluteJoint_SetSpringHertz( b3JointId jointId, float hertz );
1409
1412
1414B3_API void b3RevoluteJoint_SetSpringDampingRatio( b3JointId jointId, float dampingRatio );
1415
1418
1420B3_API void b3RevoluteJoint_SetTargetAngle( b3JointId jointId, float targetRadians );
1421
1424
1427B3_API float b3RevoluteJoint_GetAngle( b3JointId jointId );
1428
1430B3_API void b3RevoluteJoint_EnableLimit( b3JointId jointId, bool enableLimit );
1431
1434
1437
1440
1442B3_API void b3RevoluteJoint_SetLimits( b3JointId jointId, float lowerLimitRadians, float upperLimitRadians );
1443
1445B3_API void b3RevoluteJoint_EnableMotor( b3JointId jointId, bool enableMotor );
1446
1449
1451B3_API void b3RevoluteJoint_SetMotorSpeed( b3JointId jointId, float motorSpeed );
1452
1455
1458
1460B3_API void b3RevoluteJoint_SetMaxMotorTorque( b3JointId jointId, float torque );
1461
1464 // revolute_joint
1466
1474
1478
1480B3_API void b3SphericalJoint_EnableConeLimit( b3JointId jointId, bool enableLimit );
1481
1484
1487
1489B3_API void b3SphericalJoint_SetConeLimit( b3JointId jointId, float angleRadians );
1490
1493
1495B3_API void b3SphericalJoint_EnableTwistLimit( b3JointId jointId, bool enableLimit );
1496
1499
1502
1505
1507B3_API void b3SphericalJoint_SetTwistLimits( b3JointId jointId, float lowerLimitRadians, float upperLimitRadians );
1508
1511
1513B3_API void b3SphericalJoint_EnableSpring( b3JointId jointId, bool enableSpring );
1514
1517
1519B3_API void b3SphericalJoint_SetSpringHertz( b3JointId jointId, float hertz );
1520
1523
1525B3_API void b3SphericalJoint_SetSpringDampingRatio( b3JointId jointId, float dampingRatio );
1526
1529
1531B3_API void b3SphericalJoint_SetTargetRotation( b3JointId jointId, b3Quat targetRotation );
1532
1535
1537B3_API void b3SphericalJoint_EnableMotor( b3JointId jointId, bool enableMotor );
1538
1541
1543B3_API void b3SphericalJoint_SetMotorVelocity( b3JointId jointId, b3Vec3 motorVelocity );
1544
1547
1550
1552B3_API void b3SphericalJoint_SetMaxMotorTorque( b3JointId jointId, float torque );
1553
1556 // spherical_joint
1558
1569
1573
1575B3_API void b3WeldJoint_SetLinearHertz( b3JointId jointId, float hertz );
1576
1579
1581B3_API void b3WeldJoint_SetLinearDampingRatio( b3JointId jointId, float dampingRatio );
1582
1585
1587B3_API void b3WeldJoint_SetAngularHertz( b3JointId jointId, float hertz );
1588
1591
1593B3_API void b3WeldJoint_SetAngularDampingRatio( b3JointId jointId, float dampingRatio );
1594
1597 // weld_joint
1599
1609
1613
1615B3_API void b3WheelJoint_EnableSuspension( b3JointId jointId, bool flag );
1616
1619
1621B3_API void b3WheelJoint_SetSuspensionHertz( b3JointId jointId, float hertz );
1622
1625
1627B3_API void b3WheelJoint_SetSuspensionDampingRatio( b3JointId jointId, float dampingRatio );
1628
1631
1633B3_API void b3WheelJoint_EnableSuspensionLimit( b3JointId jointId, bool flag );
1634
1637
1640
1643
1645B3_API void b3WheelJoint_SetSuspensionLimits( b3JointId jointId, float lower, float upper );
1646
1648B3_API void b3WheelJoint_EnableSpinMotor( b3JointId jointId, bool flag );
1649
1652
1654B3_API void b3WheelJoint_SetSpinMotorSpeed( b3JointId jointId, float speed );
1655
1658
1660B3_API void b3WheelJoint_SetMaxSpinTorque( b3JointId jointId, float torque );
1661
1664
1666B3_API float b3WheelJoint_GetSpinSpeed( b3JointId jointId );
1667
1670
1672B3_API void b3WheelJoint_EnableSteering( b3JointId jointId, bool flag );
1673
1676
1678B3_API void b3WheelJoint_SetSteeringHertz( b3JointId jointId, float hertz );
1679
1682
1684B3_API void b3WheelJoint_SetSteeringDampingRatio( b3JointId jointId, float dampingRatio );
1685
1688
1690B3_API void b3WheelJoint_SetMaxSteeringTorque( b3JointId jointId, float torque );
1691
1694
1696B3_API void b3WheelJoint_EnableSteeringLimit( b3JointId jointId, bool flag );
1697
1700
1703
1706
1708B3_API void b3WheelJoint_SetSteeringLimits( b3JointId jointId, float lowerRadians, float upperRadians );
1709
1711B3_API void b3WheelJoint_SetTargetSteeringAngle( b3JointId jointId, float radians );
1712
1715
1718
1721 // wheel_joint
1723 // joint
1725
1731
1734
1737 // 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:1906
bool b3MoverFilterFcn(b3ShapeId shapeId, void *context)
Used to filter shapes for shape casting character movers.
Definition types.h:1854
bool b3PlaneResultFcn(b3ShapeId shapeId, const b3PlaneResult *plane, int planeCount, void *context)
Used to collect collision planes for character movers.
Definition types.h:1850
Body plane result for movers.
Definition types.h:1840
The runtime data for a compound shape.
Definition types.h:2415
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:649
Body events are buffered in the world and are available as event arrays after the time step is comple...
Definition types.h:1217
The contact data for two shapes.
Definition types.h:1252
Contact events are buffered in the world and are available as event arrays after the time step is com...
Definition types.h:1168
Joint events are buffered in the world and are available as event arrays after the time step is compl...
Definition types.h:1240
Sensor events are buffered in the world and are available as begin/end overlap event arrays after the...
Definition types.h:1080
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:740
This holds the mass data computed for a shape.
Definition types.h:1868
A height field with compressed storage.
Definition types.h:2261
A convex hull.
Definition types.h:1965
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:588
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:2200
This is a sorted triangle collision bounding volume hierarchy.
Definition types.h:2148
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:698
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:753
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:777
b3CastOutput b3WorldCastOutput
Same type in single precision.
Definition types.h:1465
Body cast result for ray and shape casts.
Definition types.h:1471
The query filter is used to filter collisions between queries and shapes.
Definition types.h:1285
Result from b3World_RayCastClosest.
Definition types.h:1323
A shape proxy is used by the GJK algorithm. It can represent a convex shape.
Definition types.h:1359
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.
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:435
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)
bool b3RecPlayer_IsAtPreStep(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...
void b3RecPlayer_SubStepFrame(b3RecPlayer *player)
Sub-step one frame.
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:461
A spatial query recorded during a replayed frame, exposed for inspection.
Definition box3d.h:447
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:821
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:1887
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:865
These are performance results returned by dynamic tree queries.
Definition types.h:1761
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:917
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:945
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:1009
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:2949