aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/Rigidbody.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-07 20:08:09 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-07 20:08:09 +0100
commit1c4156ee127b14760ed3b1a0cd16ad12180c7ac6 (patch)
tree211505d5328f24c9f9beabf8f874d9e13ef92130 /src/crepe/api/Rigidbody.cpp
parent9df087ede0b539ecbd2778236c7d1143362b384d (diff)
parent3d2428af8e8d9d49b4ade52d4806a7dae4cf1ab8 (diff)
merge `master` into `loek/savemgr`
Diffstat (limited to 'src/crepe/api/Rigidbody.cpp')
-rw-r--r--src/crepe/api/Rigidbody.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/crepe/api/Rigidbody.cpp b/src/crepe/api/Rigidbody.cpp
index 0a6262a..cbf1325 100644
--- a/src/crepe/api/Rigidbody.cpp
+++ b/src/crepe/api/Rigidbody.cpp
@@ -2,7 +2,13 @@
using namespace crepe;
-Rigidbody::Rigidbody(uint32_t game_object_id, int mass, int gravity_scale,
- BodyType bodyType)
- : Component(game_object_id), mass(mass), gravity_scale(gravity_scale),
- body_type(bodyType) {}
+crepe::Rigidbody::Rigidbody(uint32_t game_object_id, const Data & 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;
+}