From fd582eeebe716dac85531d2dda8cee2c06b8ddf9 Mon Sep 17 00:00:00 2001 From: Omniscient Date: Tue, 23 Apr 2024 21:20:52 +1000 Subject: start spitballing physics --- src/systems/physics.c | 1 + src/systems/physics.h | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 src/systems/physics.c create mode 100644 src/systems/physics.h (limited to 'src/systems') diff --git a/src/systems/physics.c b/src/systems/physics.c new file mode 100644 index 0000000..299c0c1 --- /dev/null +++ b/src/systems/physics.c @@ -0,0 +1 @@ +#include "physics.h" \ No newline at end of file diff --git a/src/systems/physics.h b/src/systems/physics.h new file mode 100644 index 0000000..17fc746 --- /dev/null +++ b/src/systems/physics.h @@ -0,0 +1,19 @@ +#pragma once + +#include "maths_types.h" + +// 'system' means that it gets called per frame + +typedef struct physics_settings { + f32 gravity_strength; +} physics_settings; + +typedef struct physics_world { + physics_settings settings; +} physics_world; + +physics_world physics_init(physics_settings settings); +void physics_shutdown(physics_world* phys_world); + +/** @brief perform one or more simulation steps */ +void physics_system_update(physics_world* phys_world, f64 deltatime); \ No newline at end of file -- cgit v1.2.3-70-g09d2 From f8375e4587612d6a582eb053be5a67694a59993d Mon Sep 17 00:00:00 2001 From: Omniscient Date: Thu, 25 Apr 2024 10:58:39 +1000 Subject: phys collider --- src/systems/physics.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/systems') diff --git a/src/systems/physics.h b/src/systems/physics.h index 17fc746..5c96c6e 100644 --- a/src/systems/physics.h +++ b/src/systems/physics.h @@ -8,6 +8,20 @@ typedef struct physics_settings { f32 gravity_strength; } physics_settings; +enum collider_type { + cuboid_collider, + sphere_collider, +}; + +/** @brief generic collider structure */ +typedef struct physics_collider { + u64 id; // ? Replace with handle? + enum collider_type shape; + transform transform; + u8 layer; + bool on_ground; +} physics_collider; + typedef struct physics_world { physics_settings settings; } physics_world; -- cgit v1.2.3-70-g09d2