diff options
Diffstat (limited to 'scene/3d/physics_body_3d.h')
-rw-r--r-- | scene/3d/physics_body_3d.h | 169 |
1 files changed, 64 insertions, 105 deletions
diff --git a/scene/3d/physics_body_3d.h b/scene/3d/physics_body_3d.h index 0e719f5108..205052f798 100644 --- a/scene/3d/physics_body_3d.h +++ b/scene/3d/physics_body_3d.h @@ -396,14 +396,11 @@ public: virtual bool _get(const StringName &p_name, Variant &r_ret) const; virtual void _get_property_list(List<PropertyInfo> *p_list) const; - real_t bias; - real_t damping; - real_t impulse_clamp; - - PinJointData() : - bias(0.3), - damping(1.), - impulse_clamp(0) {} + real_t bias = 0.3; + real_t damping = 1.; + real_t impulse_clamp = 0; + + PinJointData() {} }; struct ConeJointData : public JointData { @@ -414,17 +411,13 @@ public: virtual void _get_property_list(List<PropertyInfo> *p_list) const; real_t swing_span; - real_t twist_span; - real_t bias; - real_t softness; - real_t relaxation; + real_t twist_span = Math_PI; + real_t bias = 0.3; + real_t softness = 0.8; + real_t relaxation = 1.; ConeJointData() : - swing_span(Math_PI * 0.25), - twist_span(Math_PI), - bias(0.3), - softness(0.8), - relaxation(1.) {} + swing_span(Math_PI * 0.25) {} }; struct HingeJointData : public JointData { @@ -434,20 +427,17 @@ public: virtual bool _get(const StringName &p_name, Variant &r_ret) const; virtual void _get_property_list(List<PropertyInfo> *p_list) const; - bool angular_limit_enabled; + bool angular_limit_enabled = false; real_t angular_limit_upper; real_t angular_limit_lower; - real_t angular_limit_bias; - real_t angular_limit_softness; - real_t angular_limit_relaxation; + real_t angular_limit_bias = 0.3; + real_t angular_limit_softness = 0.9; + real_t angular_limit_relaxation = 1.; HingeJointData() : - angular_limit_enabled(false), + angular_limit_upper(Math_PI * 0.5), - angular_limit_lower(-Math_PI * 0.5), - angular_limit_bias(0.3), - angular_limit_softness(0.9), - angular_limit_relaxation(1.) {} + angular_limit_lower(-Math_PI * 0.5) {} }; struct SliderJointData : public JointData { @@ -457,76 +447,45 @@ public: virtual bool _get(const StringName &p_name, Variant &r_ret) const; virtual void _get_property_list(List<PropertyInfo> *p_list) const; - real_t linear_limit_upper; - real_t linear_limit_lower; - real_t linear_limit_softness; - real_t linear_limit_restitution; - real_t linear_limit_damping; - real_t angular_limit_upper; - real_t angular_limit_lower; - real_t angular_limit_softness; - real_t angular_limit_restitution; - real_t angular_limit_damping; - - SliderJointData() : - linear_limit_upper(1.), - linear_limit_lower(-1.), - linear_limit_softness(1.), - linear_limit_restitution(0.7), - linear_limit_damping(1.), - angular_limit_upper(0), - angular_limit_lower(0), - angular_limit_softness(1.), - angular_limit_restitution(0.7), - angular_limit_damping(1.) {} + real_t linear_limit_upper = 1.; + real_t linear_limit_lower = -1.; + real_t linear_limit_softness = 1.; + real_t linear_limit_restitution = 0.7; + real_t linear_limit_damping = 1.; + real_t angular_limit_upper = 0; + real_t angular_limit_lower = 0; + real_t angular_limit_softness = 1.; + real_t angular_limit_restitution = 0.7; + real_t angular_limit_damping = 1.; + + SliderJointData() {} }; struct SixDOFJointData : public JointData { struct SixDOFAxisData { - bool linear_limit_enabled; - real_t linear_limit_upper; - real_t linear_limit_lower; - real_t linear_limit_softness; - real_t linear_restitution; - real_t linear_damping; - bool linear_spring_enabled; - real_t linear_spring_stiffness; - real_t linear_spring_damping; - real_t linear_equilibrium_point; - bool angular_limit_enabled; - real_t angular_limit_upper; - real_t angular_limit_lower; - real_t angular_limit_softness; - real_t angular_restitution; - real_t angular_damping; - real_t erp; - bool angular_spring_enabled; - real_t angular_spring_stiffness; - real_t angular_spring_damping; - real_t angular_equilibrium_point; - - SixDOFAxisData() : - linear_limit_enabled(true), - linear_limit_upper(0), - linear_limit_lower(0), - linear_limit_softness(0.7), - linear_restitution(0.5), - linear_damping(1.), - linear_spring_enabled(false), - linear_spring_stiffness(0), - linear_spring_damping(0), - linear_equilibrium_point(0), - angular_limit_enabled(true), - angular_limit_upper(0), - angular_limit_lower(0), - angular_limit_softness(0.5), - angular_restitution(0), - angular_damping(1.), - erp(0.5), - angular_spring_enabled(false), - angular_spring_stiffness(0), - angular_spring_damping(0.), - angular_equilibrium_point(0) {} + bool linear_limit_enabled = true; + real_t linear_limit_upper = 0; + real_t linear_limit_lower = 0; + real_t linear_limit_softness = 0.7; + real_t linear_restitution = 0.5; + real_t linear_damping = 1.; + bool linear_spring_enabled = false; + real_t linear_spring_stiffness = 0; + real_t linear_spring_damping = 0; + real_t linear_equilibrium_point = 0; + bool angular_limit_enabled = true; + real_t angular_limit_upper = 0; + real_t angular_limit_lower = 0; + real_t angular_limit_softness = 0.5; + real_t angular_restitution = 0; + real_t angular_damping = 1.; + real_t erp = 0.5; + bool angular_spring_enabled = false; + real_t angular_spring_stiffness = 0; + real_t angular_spring_damping = 0.; + real_t angular_equilibrium_point = 0; + + SixDOFAxisData() {} }; virtual JointType get_joint_type() { return JOINT_TYPE_6DOF; } @@ -543,28 +502,28 @@ public: private: #ifdef TOOLS_ENABLED // if false gizmo move body - bool gizmo_move_joint; + bool gizmo_move_joint = false; #endif - JointData *joint_data; + JointData *joint_data = nullptr; Transform joint_offset; RID joint; - Skeleton3D *parent_skeleton; + Skeleton3D *parent_skeleton = nullptr; Transform body_offset; Transform body_offset_inverse; - bool simulate_physics; - bool _internal_simulate_physics; - int bone_id; + bool simulate_physics = false; + bool _internal_simulate_physics = false; + int bone_id = -1; String bone_name; - real_t bounce; - real_t mass; - real_t friction; - real_t gravity_scale; - real_t linear_damp; - real_t angular_damp; - bool can_sleep; + real_t bounce = 0; + real_t mass = 1; + real_t friction = 1; + real_t gravity_scale = 1; + real_t linear_damp = -1; + real_t angular_damp = -1; + bool can_sleep = true; protected: bool _set(const StringName &p_name, const Variant &p_value); |