Skip to content

Conversation

@kleonc
Copy link
Member

@kleonc kleonc commented Nov 18, 2025

Removes dead code: Shape2D::get_enclosing_radius and Shape3D::get_enclosing_radius virtual methods, and all their overrides. These methods are non-exposed, and are unused internally.

(not sure about labels for this PR)

@fire
Copy link
Member

fire commented Nov 18, 2025

Can we figure out the original user scenario for having get enclosing radius before removing?

@kleonc
Copy link
Member Author

kleonc commented Nov 18, 2025

Can we figure out the original user scenario for having get enclosing radius before removing?

They were added in #34776, and were used here:

void NavigationObstacle2D::update_agent_shape() {
Node *node = get_parent();
// Estimate the radius of this physics body
real_t radius = 0.0;
for (int i(0); i < node->get_child_count(); i++) {
// For each collision shape
CollisionShape2D *cs = Object::cast_to<CollisionShape2D>(node->get_child(i));
if (cs) {
// Take the distance between the Body center to the shape center
real_t r = cs->get_transform().get_origin().length();
if (cs->get_shape().is_valid()) {
// and add the enclosing shape radius
r += cs->get_shape()->get_enclosing_radius();

void NavigationObstacle::update_agent_shape() {
Node *node = get_parent();
// Estimate the radius of this physics body
real_t radius = 0.0;
for (int i(0); i < node->get_child_count(); i++) {
// For each collision shape
CollisionShape *cs = Object::cast_to<CollisionShape>(node->get_child(i));
if (cs) {
// Take the distance between the Body center to the shape center
real_t r = cs->get_transform().origin.length();
if (cs->get_shape().is_valid()) {
// and add the enclosing shape radius
r += cs->get_shape()->get_enclosing_radius();

@fire
Copy link
Member

fire commented Nov 18, 2025

I wonder the cause of deletion https://github.com/godotengine/godot/blob/master/scene/3d/navigation/navigation_obstacle_3d.cpp.

However, if we don't use it in navigation anymore, then removing get enclosing radius makes sense.

@kleonc kleonc requested a review from smix8 November 18, 2025 16:22
@smix8
Copy link
Contributor

smix8 commented Nov 18, 2025

Can we figure out the original user scenario for having get enclosing radius before removing?

I wonder the cause of deletion

Can safely remove that.

It was a misguided attempt to dynamically update the avoidance radius with changing physics shapes. The result was that most users had broken avoidance because their physics shapes messed up their avoidance setup. The original obstacle code had a special code just for physics rigid body parents to calculate broken velocity on top. All that got removed but that function was forgotten.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants