diff options
Diffstat (limited to 'scene/resources/physics_material.h')
-rw-r--r-- | scene/resources/physics_material.h | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/scene/resources/physics_material.h b/scene/resources/physics_material.h index a6cb8c288e..bf11bf0ac1 100644 --- a/scene/resources/physics_material.h +++ b/scene/resources/physics_material.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -27,42 +27,47 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef physics_material_override_H #define physics_material_override_H -#include "resource.h" +#include "core/resource.h" #include "servers/physics_server.h" class PhysicsMaterial : public Resource { GDCLASS(PhysicsMaterial, Resource); OBJ_SAVE_TYPE(PhysicsMaterial); - RES_BASE_EXTENSION("PhyMat"); + 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(); }; |