godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.93k stars 21.15k forks source link

ConcavePolygonShape triggers error on editor startup with GodotPhysics 3D #55080

Open akien-mga opened 2 years ago

akien-mga commented 2 years ago

Godot version

3.4.stable, 3.x (d3659ee0a)

System information

Linux, Mageia 9 x86_64

Issue description

Similar to #32216, there's still one case which is still reproducible in 3.x:

ERROR: Condition "!shape->is_configured()" is true. Returned: Variant()
   at: shape_get_data (servers/physics/physics_server_sw.cpp:111)
ERROR: Condition "!p_rid.is_valid()" is true. Returned: nullptr
   at: get (./core/rid.h:139)
ERROR: Condition "!body" is true.
   at: body_attach_object_instance_id (servers/physics/physics_server_sw.cpp:608)
ERROR: Invalid ID.
   at: free (servers/physics/physics_server_sw.cpp:1278)

A backtrace points at PhysicsServerSW::shape_get_data called by ConcavePolygonShape::get_faces:

(gdb) bt
#0  _err_print_error (p_function=0x5994550 "shape_get_data", p_file=0x5994430 "servers/physics/physics_server_sw.cpp", p_line=111, 
    p_error=0x5994560 "Condition \"!shape->is_configured()\" is true. Returned: Variant()", p_message=0x59cf1b6 "", p_type=ERR_HANDLER_ERROR) at core/error_macros.cpp:77
#1  0x0000000004313f79 in _err_print_error (p_function=0x5994550 "shape_get_data", p_file=0x5994430 "servers/physics/physics_server_sw.cpp", p_line=111, 
    p_error=0x5994560 "Condition \"!shape->is_configured()\" is true. Returned: Variant()", p_type=ERR_HANDLER_ERROR) at core/error_macros.cpp:69
#2  0x0000000003fffbe0 in PhysicsServerSW::shape_get_data (this=0x80068d0, p_shape=...) at servers/physics/physics_server_sw.cpp:111
#3  0x0000000003b943eb in ConcavePolygonShape::get_faces (this=0x8335b40) at scene/resources/concave_polygon_shape.cpp:74
#4  0x0000000001b1da62 in MethodBind0RC<PoolVector<Vector3> >::call (this=0x7ee3040, p_object=0x8335b40, p_args=0x0, p_arg_count=0, r_error=...) at ./core/method_bind.gen.inc:593
#5  0x00000000042f49dd in ClassDB::get_property (p_object=0x8335b40, p_property=..., r_value=...) at core/class_db.cpp:1046
#6  0x000000000437e8b4 in Object::get (this=0x8335b40, p_name=..., r_valid=0x0) at core/object.cpp:499
#7  0x00000000042f6a91 in ClassDB::class_get_default_property_value (p_class=..., p_property=..., r_valid=0x7fffffff78b7) at core/class_db.cpp:1366
#8  0x0000000002d1d65e in get_documentation_default_value (p_class_name=..., p_property_name=..., r_default_value_valid=@0x7fffffff78b7: false) at editor/doc/doc_data.cpp:214
#9  0x0000000002d1dfce in DocData::generate (this=0x82de330, p_basic_types=true) at editor/doc/doc_data.cpp:306
#10 0x00000000029bcb40 in EditorHelp::generate_doc () at editor/editor_help.cpp:1465
#11 0x0000000002a3188d in EditorNode::EditorNode (this=0x82f4390) at editor/editor_node.cpp:5747
#12 0x0000000001752c6f in Main::start () at main/main.cpp:1875
#13 0x00000000017087fc in main (argc=4, argv=0x7fffffffd6f8) at platform/x11/godot_x11.cpp:54

Like #32216, this is probably triggered by the EditorHelp generation code. The error happens when opening the editor, and not when running a project.

Adding a CollisionShape with ConcavePolygonShape in a scene also triggers this error:

ERROR: Condition "!shape->is_configured()" is true. Returned: Variant()
   at: shape_get_data (servers/physics/physics_server_sw.cpp:111)

This also happens when disabling Bullet with module_bullet_enabled=yes, since it falls back to GodotPhysics when still using DEFAULT as 3D physics backend.

Steps to reproduce

Minimal reproduction project

TestGodotPhysics.zip

akien-mga commented 2 years ago

There's a difference between 3.x and master in CollisionPolygonShape3D::get_faces, where in master it's now getting a member variable, instead of calling into PhysicsServer3D.

So this might have been fixed in master as a consequence of 7bbd5454329.

Haxeil commented 2 years ago

I have the same Err when i compiled godot with this command : scons p=x11 target=release_debug tools=yes module_mono_enabled=yes disable_3d=no module_arkit_enabled=no module_bmp_enabled=no module_bullet_enabled=no module_camera_enabled=no module_enet_enabled=no module_mobile_vr_enabled=no module_upnp_enabled=no module_visual_script_enabled=no module_gdscript_enabled=yes

I disabled gdscript since i only want to use C# maybe GDnative. will these errors effect my final project with C# ?, i wanted to reduce the final game's size as much as possible, but if it's going to cause problems then i'll just use the normal build.

ERROR: Mono: Core API hash mismatch.
   at: _init_godot_api_hashes (modules/mono/mono_gd/gd_mono.cpp:490)
Mono: Log file is: '/home/haxeil/.local/share/godot/mono/mono_logs/2022-02-03_15.23.21_1281.log'
ERROR: Condition "!shape->is_configured()" is true. Returned: Variant()
   at: shape_get_data (servers/physics/physics_server_sw.cpp:111)
ERROR: Condition "!p_rid.is_valid()" is true. Returned: nullptr
   at: get (./core/rid.h:139)
ERROR: Condition "!body" is true.
   at: body_attach_object_instance_id (servers/physics/physics_server_sw.cpp:608)
ERROR: Invalid ID.
   at: free (servers/physics/physics_server_sw.cpp:1278)
Calinou commented 2 years ago

will these errors effect my final project with C# ?, i wanted to reduce the final game's size as much as possible, but if it's going to cause problems then i'll just use the normal build.

Run your project and see if physics still work correctly :slightly_smiling_face:

That said, disabling the GDScript module won't decrease binary size by much. Using optimize=size will generally decrease binary size more than disabling any module will.

Haxeil commented 2 years ago

yes everything works fine i had no problems. i forgot to add optimize=size :)

pseidemann commented 1 year ago

I have the exact same error with v3.5.1.stable.official [6fed1ffa3] and thought first it's an issue with my project