summaryrefslogtreecommitdiff
path: root/scene/resources/physics_material.h
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2018-08-07 15:31:26 -0300
committerGitHub <noreply@github.com>2018-08-07 15:31:26 -0300
commit14fd797c536a675c94c36a2b2b924ce0295f5d64 (patch)
tree9ac70ce41c656f726402187f0fd90e578036c3af /scene/resources/physics_material.h
parente0456f7976832b9f17958e1e8e7c18379b19e382 (diff)
parent5e65e28eed1398cceb4b77cb99ba6578115953db (diff)
Merge pull request #20381 from AndreaCatania/phymat_2
Improved Physics material
Diffstat (limited to 'scene/resources/physics_material.h')
-rw-r--r--scene/resources/physics_material.h32
1 files changed, 18 insertions, 14 deletions
diff --git a/scene/resources/physics_material.h b/scene/resources/physics_material.h
index a6cb8c288e..dfe48d94cf 100644
--- a/scene/resources/physics_material.h
+++ b/scene/resources/physics_material.h
@@ -39,30 +39,34 @@ class PhysicsMaterial : public Resource {
OBJ_SAVE_TYPE(PhysicsMaterial);
RES_BASE_EXTENSION("PhyMat");
- real_t bounce;
- PhysicsServer::CombineMode bounce_combine_mode;
real_t friction;
- PhysicsServer::CombineMode friction_combine_mode;
+ bool rough;
+ real_t bounce;
+ bool absorbent;
protected:
- bool _set(const StringName &p_name, const Variant &p_value);
- bool _get(const StringName &p_name, Variant &r_ret) const;
- void _get_property_list(List<PropertyInfo> *p_list) const;
-
static void _bind_methods();
public:
+ void set_friction(real_t p_val);
+ _FORCE_INLINE_ real_t get_friction() const { return friction; }
+
+ void set_rough(bool p_val);
+ _FORCE_INLINE_ bool is_rough() const { return rough; }
+
+ _FORCE_INLINE_ real_t computed_friction() const {
+ return rough ? -friction : friction;
+ }
+
void set_bounce(real_t p_val);
_FORCE_INLINE_ real_t get_bounce() const { return bounce; }
- void set_bounce_combine_mode(PhysicsServer::CombineMode p_val);
- _FORCE_INLINE_ PhysicsServer::CombineMode get_bounce_combine_mode() const { return bounce_combine_mode; }
-
- void set_friction(real_t p_val);
- _FORCE_INLINE_ real_t get_friction() const { return friction; }
+ void set_absorbent(bool p_val);
+ _FORCE_INLINE_ bool is_absorbent() const { return absorbent; }
- void set_friction_combine_mode(PhysicsServer::CombineMode p_val);
- _FORCE_INLINE_ PhysicsServer::CombineMode get_friction_combine_mode() const { return friction_combine_mode; }
+ _FORCE_INLINE_ real_t computed_bounce() const {
+ return absorbent ? -bounce : bounce;
+ }
PhysicsMaterial();
};