blob: 53a895de79b13f5e56f0d8b24c587ac0b9cd1f90 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#include "physics.h"
PhysicsInfo physics = {0};
void
physics_init(void) {
physics.world_def = b3DefaultWorldDef();
physics.world_id = b3CreateWorld(&physics.world_def);
physics.simulate = false;
}
void
physics_exit(void) {
if (b3World_IsValid(physics.world_id)) {
b3DestroyWorld(physics.world_id);
}
physics.world_id = b3_nullWorldId;
}
void
physics_update(void) {
if (!physics.simulate) {
return;
}
// TODO: timestep is temporary, should be global value
b3World_Step(physics.world_id, 1.0f / 60.0f, 4);
}
// PhysicsObject
// physics_obj_create_def(void) {
// PhysicsObject obj = {0};
// return obj;
// }
// void
// physics_obj_delete(PhysicsObject* phys) {
// }
|