mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 21:22:48 +00:00
Merge pull request #43925 from madmiraal/fix-16039a
Remove RigidBody weight property
This commit is contained in:
commit
95572211bb
@ -174,9 +174,6 @@
|
||||
<member name="sleeping" type="bool" setter="set_sleeping" getter="is_sleeping" default="false">
|
||||
If [code]true[/code], the body will not move and will not calculate forces until woken up by another body through, for example, a collision, or by using the [method apply_impulse] or [method add_force] methods.
|
||||
</member>
|
||||
<member name="weight" type="float" setter="set_weight" getter="get_weight" default="9.8">
|
||||
The body's weight based on its mass and the [b]Default Gravity[/b] value in [b]Project > Project Settings > Physics > 2d[/b].
|
||||
</member>
|
||||
</members>
|
||||
<signals>
|
||||
<signal name="body_entered">
|
||||
|
@ -198,9 +198,6 @@
|
||||
<member name="sleeping" type="bool" setter="set_sleeping" getter="is_sleeping" default="false">
|
||||
If [code]true[/code], the body will not move and will not calculate forces until woken up by another body through, for example, a collision, or by using the [method apply_impulse] or [method add_force] methods.
|
||||
</member>
|
||||
<member name="weight" type="float" setter="set_weight" getter="get_weight" default="9.8">
|
||||
The body's weight based on its mass and the global 3D gravity. Global values are set in [b]Project > Project Settings > Physics > 3d[/b].
|
||||
</member>
|
||||
</members>
|
||||
<signals>
|
||||
<signal name="body_entered">
|
||||
|
@ -460,8 +460,6 @@ RigidBody2D::Mode RigidBody2D::get_mode() const {
|
||||
void RigidBody2D::set_mass(real_t p_mass) {
|
||||
ERR_FAIL_COND(p_mass <= 0);
|
||||
mass = p_mass;
|
||||
_change_notify("mass");
|
||||
_change_notify("weight");
|
||||
PhysicsServer2D::get_singleton()->body_set_param(get_rid(), PhysicsServer2D::BODY_PARAM_MASS, mass);
|
||||
}
|
||||
|
||||
@ -478,14 +476,6 @@ real_t RigidBody2D::get_inertia() const {
|
||||
return PhysicsServer2D::get_singleton()->body_get_param(get_rid(), PhysicsServer2D::BODY_PARAM_INERTIA);
|
||||
}
|
||||
|
||||
void RigidBody2D::set_weight(real_t p_weight) {
|
||||
set_mass(p_weight / (real_t(GLOBAL_DEF("physics/2d/default_gravity", 98)) / 10));
|
||||
}
|
||||
|
||||
real_t RigidBody2D::get_weight() const {
|
||||
return mass * (real_t(GLOBAL_DEF("physics/2d/default_gravity", 98)) / 10);
|
||||
}
|
||||
|
||||
void RigidBody2D::set_physics_material_override(const Ref<PhysicsMaterial> &p_physics_material_override) {
|
||||
if (physics_material_override.is_valid()) {
|
||||
if (physics_material_override->is_connected(CoreStringNames::get_singleton()->changed, callable_mp(this, &RigidBody2D::_reload_physics_characteristics))) {
|
||||
@ -753,9 +743,6 @@ void RigidBody2D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_inertia"), &RigidBody2D::get_inertia);
|
||||
ClassDB::bind_method(D_METHOD("set_inertia", "inertia"), &RigidBody2D::set_inertia);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_weight", "weight"), &RigidBody2D::set_weight);
|
||||
ClassDB::bind_method(D_METHOD("get_weight"), &RigidBody2D::get_weight);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_physics_material_override", "physics_material_override"), &RigidBody2D::set_physics_material_override);
|
||||
ClassDB::bind_method(D_METHOD("get_physics_material_override"), &RigidBody2D::get_physics_material_override);
|
||||
|
||||
@ -818,7 +805,6 @@ void RigidBody2D::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Rigid,Static,Character,Kinematic"), "set_mode", "get_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "mass", PROPERTY_HINT_EXP_RANGE, "0.01,65535,0.01"), "set_mass", "get_mass");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "inertia", PROPERTY_HINT_EXP_RANGE, "0.01,65535,0.01", 0), "set_inertia", "get_inertia");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "weight", PROPERTY_HINT_EXP_RANGE, "0.01,65535,0.01", PROPERTY_USAGE_EDITOR), "set_weight", "get_weight");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "physics_material_override", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsMaterial"), "set_physics_material_override", "get_physics_material_override");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "gravity_scale", PROPERTY_HINT_RANGE, "-128,128,0.01"), "set_gravity_scale", "get_gravity_scale");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "custom_integrator"), "set_use_custom_integrator", "is_using_custom_integrator");
|
||||
|
@ -192,9 +192,6 @@ public:
|
||||
void set_inertia(real_t p_inertia);
|
||||
real_t get_inertia() const;
|
||||
|
||||
void set_weight(real_t p_weight);
|
||||
real_t get_weight() const;
|
||||
|
||||
void set_physics_material_override(const Ref<PhysicsMaterial> &p_physics_material_override);
|
||||
Ref<PhysicsMaterial> get_physics_material_override() const;
|
||||
|
||||
|
@ -478,8 +478,6 @@ RigidBody3D::Mode RigidBody3D::get_mode() const {
|
||||
void RigidBody3D::set_mass(real_t p_mass) {
|
||||
ERR_FAIL_COND(p_mass <= 0);
|
||||
mass = p_mass;
|
||||
_change_notify("mass");
|
||||
_change_notify("weight");
|
||||
PhysicsServer3D::get_singleton()->body_set_param(get_rid(), PhysicsServer3D::BODY_PARAM_MASS, mass);
|
||||
}
|
||||
|
||||
@ -487,14 +485,6 @@ real_t RigidBody3D::get_mass() const {
|
||||
return mass;
|
||||
}
|
||||
|
||||
void RigidBody3D::set_weight(real_t p_weight) {
|
||||
set_mass(p_weight / real_t(GLOBAL_DEF("physics/3d/default_gravity", 9.8)));
|
||||
}
|
||||
|
||||
real_t RigidBody3D::get_weight() const {
|
||||
return mass * real_t(GLOBAL_DEF("physics/3d/default_gravity", 9.8));
|
||||
}
|
||||
|
||||
void RigidBody3D::set_physics_material_override(const Ref<PhysicsMaterial> &p_physics_material_override) {
|
||||
if (physics_material_override.is_valid()) {
|
||||
if (physics_material_override->is_connected(CoreStringNames::get_singleton()->changed, callable_mp(this, &RigidBody3D::_reload_physics_characteristics))) {
|
||||
@ -740,9 +730,6 @@ void RigidBody3D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_mass", "mass"), &RigidBody3D::set_mass);
|
||||
ClassDB::bind_method(D_METHOD("get_mass"), &RigidBody3D::get_mass);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_weight", "weight"), &RigidBody3D::set_weight);
|
||||
ClassDB::bind_method(D_METHOD("get_weight"), &RigidBody3D::get_weight);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_physics_material_override", "physics_material_override"), &RigidBody3D::set_physics_material_override);
|
||||
ClassDB::bind_method(D_METHOD("get_physics_material_override"), &RigidBody3D::get_physics_material_override);
|
||||
|
||||
@ -802,7 +789,6 @@ void RigidBody3D::_bind_methods() {
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Rigid,Static,Character,Kinematic"), "set_mode", "get_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "mass", PROPERTY_HINT_EXP_RANGE, "0.01,65535,0.01"), "set_mass", "get_mass");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "weight", PROPERTY_HINT_EXP_RANGE, "0.01,65535,0.01", PROPERTY_USAGE_EDITOR), "set_weight", "get_weight");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "physics_material_override", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsMaterial"), "set_physics_material_override", "get_physics_material_override");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "gravity_scale", PROPERTY_HINT_RANGE, "-128,128,0.01"), "set_gravity_scale", "get_gravity_scale");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "custom_integrator"), "set_use_custom_integrator", "is_using_custom_integrator");
|
||||
@ -2121,9 +2107,6 @@ void PhysicalBone3D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_mass", "mass"), &PhysicalBone3D::set_mass);
|
||||
ClassDB::bind_method(D_METHOD("get_mass"), &PhysicalBone3D::get_mass);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_weight", "weight"), &PhysicalBone3D::set_weight);
|
||||
ClassDB::bind_method(D_METHOD("get_weight"), &PhysicalBone3D::get_weight);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_friction", "friction"), &PhysicalBone3D::set_friction);
|
||||
ClassDB::bind_method(D_METHOD("get_friction"), &PhysicalBone3D::get_friction);
|
||||
|
||||
@ -2154,7 +2137,6 @@ void PhysicalBone3D::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "body_offset"), "set_body_offset", "get_body_offset");
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "mass", PROPERTY_HINT_EXP_RANGE, "0.01,65535,0.01"), "set_mass", "get_mass");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "weight", PROPERTY_HINT_EXP_RANGE, "0.01,65535,0.01"), "set_weight", "get_weight");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "friction", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_friction", "get_friction");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "bounce", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_bounce", "get_bounce");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "gravity_scale", PROPERTY_HINT_RANGE, "-10,10,0.01"), "set_gravity_scale", "get_gravity_scale");
|
||||
@ -2456,14 +2438,6 @@ real_t PhysicalBone3D::get_mass() const {
|
||||
return mass;
|
||||
}
|
||||
|
||||
void PhysicalBone3D::set_weight(real_t p_weight) {
|
||||
set_mass(p_weight / real_t(GLOBAL_DEF("physics/3d/default_gravity", 9.8)));
|
||||
}
|
||||
|
||||
real_t PhysicalBone3D::get_weight() const {
|
||||
return mass * real_t(GLOBAL_DEF("physics/3d/default_gravity", 9.8));
|
||||
}
|
||||
|
||||
void PhysicalBone3D::set_friction(real_t p_friction) {
|
||||
ERR_FAIL_COND(p_friction < 0 || p_friction > 1);
|
||||
|
||||
|
@ -185,9 +185,6 @@ public:
|
||||
|
||||
virtual float get_inverse_mass() const override { return 1.0 / mass; }
|
||||
|
||||
void set_weight(real_t p_weight);
|
||||
real_t get_weight() const;
|
||||
|
||||
void set_physics_material_override(const Ref<PhysicsMaterial> &p_physics_material_override);
|
||||
Ref<PhysicsMaterial> get_physics_material_override() const;
|
||||
|
||||
@ -572,9 +569,6 @@ public:
|
||||
void set_mass(real_t p_mass);
|
||||
real_t get_mass() const;
|
||||
|
||||
void set_weight(real_t p_weight);
|
||||
real_t get_weight() const;
|
||||
|
||||
void set_friction(real_t p_friction);
|
||||
real_t get_friction() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user