aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/api')
-rw-r--r--src/crepe/api/BoxCollider.cpp2
-rw-r--r--src/crepe/api/BoxCollider.h2
-rw-r--r--src/crepe/api/CircleCollider.cpp2
-rw-r--r--src/crepe/api/CircleCollider.h2
-rw-r--r--src/crepe/api/Rigidbody.h14
5 files changed, 9 insertions, 13 deletions
diff --git a/src/crepe/api/BoxCollider.cpp b/src/crepe/api/BoxCollider.cpp
index 6034837..1069e90 100644
--- a/src/crepe/api/BoxCollider.cpp
+++ b/src/crepe/api/BoxCollider.cpp
@@ -4,4 +4,4 @@
using namespace crepe;
-BoxCollider::BoxCollider(game_object_id_t game_object_id,vec2 offset, float width, float height) : Collider(game_object_id,offset), width(width), height(height) {}
+BoxCollider::BoxCollider(game_object_id_t game_object_id,const vec2& offset, float width, float height) : Collider(game_object_id,offset), width(width), height(height) {}
diff --git a/src/crepe/api/BoxCollider.h b/src/crepe/api/BoxCollider.h
index 2ce1ee8..c83d54a 100644
--- a/src/crepe/api/BoxCollider.h
+++ b/src/crepe/api/BoxCollider.h
@@ -12,7 +12,7 @@ namespace crepe {
*/
class BoxCollider : public Collider {
public:
- BoxCollider(game_object_id_t game_object_id,vec2 offset, float width, float height);
+ BoxCollider(game_object_id_t game_object_id,const vec2& offset, float width, float height);
//! Width of box collider
float width;
diff --git a/src/crepe/api/CircleCollider.cpp b/src/crepe/api/CircleCollider.cpp
index 497ebba..473734e 100644
--- a/src/crepe/api/CircleCollider.cpp
+++ b/src/crepe/api/CircleCollider.cpp
@@ -3,4 +3,4 @@
using namespace crepe;
-CircleCollider::CircleCollider(game_object_id_t game_object_id,vec2 offset, float radius) : Collider(game_object_id,offset), radius(radius) {}
+CircleCollider::CircleCollider(game_object_id_t game_object_id,const vec2& offset, float radius) : Collider(game_object_id,offset), radius(radius) {}
diff --git a/src/crepe/api/CircleCollider.h b/src/crepe/api/CircleCollider.h
index c61f027..bbcc330 100644
--- a/src/crepe/api/CircleCollider.h
+++ b/src/crepe/api/CircleCollider.h
@@ -14,7 +14,7 @@ namespace crepe {
class CircleCollider : public Collider {
public:
- CircleCollider(game_object_id_t game_object_id,vec2 offset, float radius);
+ CircleCollider(game_object_id_t game_object_id,const vec2& offset, float radius);
//! Radius of the circle collider.
float radius;
diff --git a/src/crepe/api/Rigidbody.h b/src/crepe/api/Rigidbody.h
index 446c5dd..63b1b51 100644
--- a/src/crepe/api/Rigidbody.h
+++ b/src/crepe/api/Rigidbody.h
@@ -54,7 +54,7 @@ public:
//! objects mass
float mass = 0.0;
//! gravtiy scale
- float gravity_scale = 0.0;
+ float gravity_scale = 0;
//! Changes if physics apply
BodyType body_type = BodyType::DYNAMIC;
//! linear velocity of object
@@ -62,20 +62,16 @@ public:
//! maximum linear velocity of object
vec2 max_linear_velocity = {INFINITY ,INFINITY};
//! linear damping of object
- vec2 linear_damping;
+ vec2 linear_velocity_factor;
//! angular velocity of object
- float angular_velocity = 0.0;
+ float angular_velocity = 1;
//! max angular velocity of object
float max_angular_velocity = INFINITY;
//! angular damping of object
- float angular_damping = 0.0;
+ float angular_velocity_factor = 1;
//! movements constraints of object
PhysicsConstraints constraints;
- //! if gravity applies
- bool use_gravity = true;
- //! if object bounces
- bool bounce = false;
- //! bounce factor of material
+ //! bounce factor of material. 0.0 <= means all velocity is lost, 1.0 means it gets the same momentum but the mirrored direction. 0.5 is half of the velocity is saved.
float elastisity = 0.0;
//! offset of all colliders relative to transform position
vec2 offset;