aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/Rigidbody.cpp
diff options
context:
space:
mode:
authorjaroWMR <jarorutjes07@gmail.com>2024-11-07 18:39:56 +0100
committerjaroWMR <jarorutjes07@gmail.com>2024-11-07 18:39:56 +0100
commite2f3ace383b43cc3f140629e577b97c6f69c9856 (patch)
tree690eb146e11a4bc134840ec82bfbea4805daba61 /src/crepe/api/Rigidbody.cpp
parent156906dca0b84d3fd3c889e1bcda12308b8fe793 (diff)
added physics system
Diffstat (limited to 'src/crepe/api/Rigidbody.cpp')
-rw-r--r--src/crepe/api/Rigidbody.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/crepe/api/Rigidbody.cpp b/src/crepe/api/Rigidbody.cpp
index 1e76346..cf07b0e 100644
--- a/src/crepe/api/Rigidbody.cpp
+++ b/src/crepe/api/Rigidbody.cpp
@@ -2,7 +2,15 @@
using namespace crepe;
-Rigidbody::Rigidbody(game_object_id_t id, int mass, int gravity_scale,
- BodyType bodyType)
- : Component(id), mass(mass), gravity_scale(gravity_scale),
- body_type(bodyType) {}
+crepe::Rigidbody::Rigidbody(uint32_t game_object_id,
+ const RigidbodyData & data) :
+ Component(game_object_id), data(data){}
+
+void crepe::Rigidbody::add_force_linear(const Vector2 & force) {
+ this->data.linear_velocity += force;
+}
+
+void crepe::Rigidbody::add_force_angular(double force) {
+ this->data.angular_velocity += force;
+}
+