You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-09 12:50:35 +00:00
Merge pull request #103504 from lawnjelly/fti_warn_physics_non_interp4
Physics Interpolation - Add editor configuration warnings
This commit is contained in:
@@ -169,3 +169,13 @@ void PhysicsBody2D::remove_collision_exception_with(Node *p_node) {
|
|||||||
ERR_FAIL_NULL_MSG(physics_body, "Collision exception only works between two nodes that inherit from PhysicsBody2D.");
|
ERR_FAIL_NULL_MSG(physics_body, "Collision exception only works between two nodes that inherit from PhysicsBody2D.");
|
||||||
PhysicsServer2D::get_singleton()->body_remove_collision_exception(get_rid(), physics_body->get_rid());
|
PhysicsServer2D::get_singleton()->body_remove_collision_exception(get_rid(), physics_body->get_rid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PackedStringArray PhysicsBody2D::get_configuration_warnings() const {
|
||||||
|
PackedStringArray warnings = CollisionObject2D::get_configuration_warnings();
|
||||||
|
|
||||||
|
if (!is_physics_interpolated()) {
|
||||||
|
warnings.push_back(RTR("PhysicsBody2D will not work correctly on a non-interpolated branch of the SceneTree.\nCheck the node's inherited physics_interpolation_mode."));
|
||||||
|
}
|
||||||
|
|
||||||
|
return warnings;
|
||||||
|
}
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ protected:
|
|||||||
Ref<KinematicCollision2D> _move(const Vector2 &p_motion, bool p_test_only = false, real_t p_margin = 0.08, bool p_recovery_as_collision = false);
|
Ref<KinematicCollision2D> _move(const Vector2 &p_motion, bool p_test_only = false, real_t p_margin = 0.08, bool p_recovery_as_collision = false);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
PackedStringArray get_configuration_warnings() const override;
|
||||||
|
|
||||||
bool move_and_collide(const PhysicsServer2D::MotionParameters &p_parameters, PhysicsServer2D::MotionResult &r_result, bool p_test_only = false, bool p_cancel_sliding = true);
|
bool move_and_collide(const PhysicsServer2D::MotionParameters &p_parameters, PhysicsServer2D::MotionResult &r_result, bool p_test_only = false, bool p_cancel_sliding = true);
|
||||||
bool test_move(const Transform2D &p_from, const Vector2 &p_motion, const Ref<KinematicCollision2D> &r_collision = Ref<KinematicCollision2D>(), real_t p_margin = 0.08, bool p_recovery_as_collision = false);
|
bool test_move(const Transform2D &p_from, const Vector2 &p_motion, const Ref<KinematicCollision2D> &r_collision = Ref<KinematicCollision2D>(), real_t p_margin = 0.08, bool p_recovery_as_collision = false);
|
||||||
Vector2 get_gravity() const;
|
Vector2 get_gravity() const;
|
||||||
|
|||||||
@@ -210,6 +210,16 @@ real_t PhysicsBody3D::get_inverse_mass() const {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PackedStringArray PhysicsBody3D::get_configuration_warnings() const {
|
||||||
|
PackedStringArray warnings = CollisionObject3D::get_configuration_warnings();
|
||||||
|
|
||||||
|
if (!is_physics_interpolated()) {
|
||||||
|
warnings.push_back(RTR("PhysicsBody3D will not work correctly on a non-interpolated branch of the SceneTree.\nCheck the node's inherited physics_interpolation_mode."));
|
||||||
|
}
|
||||||
|
|
||||||
|
return warnings;
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
|
|
||||||
//so, if you pass 45 as limit, avoid numerical precision errors when angle is 45.
|
//so, if you pass 45 as limit, avoid numerical precision errors when angle is 45.
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ protected:
|
|||||||
Ref<KinematicCollision3D> _move(const Vector3 &p_motion, bool p_test_only = false, real_t p_margin = 0.001, bool p_recovery_as_collision = false, int p_max_collisions = 1);
|
Ref<KinematicCollision3D> _move(const Vector3 &p_motion, bool p_test_only = false, real_t p_margin = 0.001, bool p_recovery_as_collision = false, int p_max_collisions = 1);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
PackedStringArray get_configuration_warnings() const override;
|
||||||
|
|
||||||
bool move_and_collide(const PhysicsServer3D::MotionParameters &p_parameters, PhysicsServer3D::MotionResult &r_result, bool p_test_only = false, bool p_cancel_sliding = true);
|
bool move_and_collide(const PhysicsServer3D::MotionParameters &p_parameters, PhysicsServer3D::MotionResult &r_result, bool p_test_only = false, bool p_cancel_sliding = true);
|
||||||
bool test_move(const Transform3D &p_from, const Vector3 &p_motion, const Ref<KinematicCollision3D> &r_collision = Ref<KinematicCollision3D>(), real_t p_margin = 0.001, bool p_recovery_as_collision = false, int p_max_collisions = 1);
|
bool test_move(const Transform3D &p_from, const Vector3 &p_motion, const Ref<KinematicCollision3D> &r_collision = Ref<KinematicCollision3D>(), real_t p_margin = 0.001, bool p_recovery_as_collision = false, int p_max_collisions = 1);
|
||||||
Vector3 get_gravity() const;
|
Vector3 get_gravity() const;
|
||||||
|
|||||||
@@ -516,6 +516,8 @@ void Node::_propagate_physics_interpolated(bool p_interpolated) {
|
|||||||
// Allow a call to the RenderingServer etc. in derived classes.
|
// Allow a call to the RenderingServer etc. in derived classes.
|
||||||
_physics_interpolated_changed();
|
_physics_interpolated_changed();
|
||||||
|
|
||||||
|
update_configuration_warnings();
|
||||||
|
|
||||||
data.blocked++;
|
data.blocked++;
|
||||||
for (KeyValue<StringName, Node *> &K : data.children) {
|
for (KeyValue<StringName, Node *> &K : data.children) {
|
||||||
K.value->_propagate_physics_interpolated(p_interpolated);
|
K.value->_propagate_physics_interpolated(p_interpolated);
|
||||||
|
|||||||
Reference in New Issue
Block a user