Improved RigidDynamicBody linear/angular damping override

Damping values are now non-negative.

Add new properties linear_damp_mode and angular_damp_mode to set the way
RigidDynamicBody and PhysicalBone (2D & 3D) use damping values.
It can now be Combine (default) to add to the default/areas, or Replace
to override the value completely (current behavior).
This commit is contained in:
PouleyKetchoupp
2020-04-14 19:59:53 +02:00
parent 24fdedfe94
commit daf7dcac7a
20 changed files with 382 additions and 127 deletions

View File

@ -400,11 +400,18 @@ public:
BODY_PARAM_INERTIA,
BODY_PARAM_CENTER_OF_MASS,
BODY_PARAM_GRAVITY_SCALE,
BODY_PARAM_LINEAR_DAMP_MODE,
BODY_PARAM_ANGULAR_DAMP_MODE,
BODY_PARAM_LINEAR_DAMP,
BODY_PARAM_ANGULAR_DAMP,
BODY_PARAM_MAX,
};
enum BodyDampMode {
BODY_DAMP_MODE_COMBINE,
BODY_DAMP_MODE_REPLACE,
};
virtual void body_set_param(RID p_body, BodyParameter p_param, const Variant &p_value) = 0;
virtual Variant body_get_param(RID p_body, BodyParameter p_param) const = 0;
@ -692,12 +699,12 @@ VARIANT_ENUM_CAST(PhysicsServer2D::AreaParameter);
VARIANT_ENUM_CAST(PhysicsServer2D::AreaSpaceOverrideMode);
VARIANT_ENUM_CAST(PhysicsServer2D::BodyMode);
VARIANT_ENUM_CAST(PhysicsServer2D::BodyParameter);
VARIANT_ENUM_CAST(PhysicsServer2D::BodyDampMode);
VARIANT_ENUM_CAST(PhysicsServer2D::BodyState);
VARIANT_ENUM_CAST(PhysicsServer2D::CCDMode);
VARIANT_ENUM_CAST(PhysicsServer2D::JointParam);
VARIANT_ENUM_CAST(PhysicsServer2D::JointType);
VARIANT_ENUM_CAST(PhysicsServer2D::DampedSpringParam);
//VARIANT_ENUM_CAST( PhysicsServer2D::ObjectType );
VARIANT_ENUM_CAST(PhysicsServer2D::AreaBodyStatus);
VARIANT_ENUM_CAST(PhysicsServer2D::ProcessInfo);