-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fatal error (Index p_index = 0 is out of bounds) when closing the game #341
Comments
Thanks for the detailed report.
Is this reproducible in a nightly build from
I'm curious why this is only in your project. It doesn't happen for you in the demo? And it doesn't happen for me. This needs further exploration as to what conditions you've created in your project to trigger these errors.
What is a Does this scene contain any scripts attached to those nodes? Are the Camera3D and Terrain3D attached to a parent Node3D or what structure? What other nodes are in the scene? In this scene preview, does it quit automatically via your script or manually?
There is already a check in this section to make sure the staticbody that contains the shape is valid. What's more concerning is why you don't have a collision shape. If you have collision enabled, the shape should exist to be destroyed. If you don't, the staticbody will be null and it won't try to destroy it.
I don't get this on the demo or in my project. Do you have two copies of Terrain3D under addons in different folders? Whatever is causing this might be the problem. I presume that you don't get this in the demo project?
How much time is elapsing between build collision / READY and EXIT_TREE? Are they instant, within the same frame caused by a script quitting? Or are there multiple frames rendered at least in between? |
Replying with some easier-to-get answers to your questions. :)
It may be my wrong use of terminology, I'm just using F6 to preview the current scene.
The scene contains:
I have attached the smallest project that reproduces the issue. TerrainRepro.zip
I'm closing the preview by clicking the X button of the window.
You're right, it was my bad - I was making copies of the addons folder (in order to rapidly switch between the Terrain3D that I downloaded from github and the one I built myself) thinking that it's a specially named folder from Godot's perspective. The repro project that I attached should not have this problem.
I assume there's multiple frames in between. When the scene is loaded, the log reaches the |
I think I may know what the problem is. |
I have tried with my own custom build yet again. The changes I've made:
The log excerpt is:
Notably, my newly added log is not present, presumably because there are no regions on the Terrain3D. |
I see. If there are no regions, the static body is still created but no shapes are made, so it should not assume there is a region to destroy. We'll need to make sure #278 fixes this. |
We also get this error when calling load_region on an empty terrain. It also crashes the game. You have to disable collision before calling. Terrain3D#1732:set_data_directory: Setting data directory to res://terrain/ |
Hey, had the same error as the op. ERROR: FATAL: Index p_index = 0 is out of bounds (shapes.size() = 0). My Gpu is an AMD RX 7800XT. My issue was as soon as I press the Run Project button the window would crash, I had an addon enabled called Cyclops Level Builder, so I tried disabling the addon and running the project works now. Unfortunately I can't provide the logs with the error as now Cyclops Level Builder cannot be enabled, getting a ton of errors when I try to enable it. Godot Engine v4.3.stable |
Yeah, I'm having the same issue. My gpu is a RTX 3060 and I'm on Godot v4.3.stable. |
Terrain3D version
v0.9.1-beta
System information
Godot v4.2.1.stable - Windows 10.0.22631 - Vulkan (Forward+) - dedicated AMD Radeon RX 7900 XT (Advanced Micro Devices, Inc.; 31.0.24019.1006) - AMD Ryzen 9 7900 12-Core Processor (24 Threads)
Is the issue reproducable in the demo?
No
Issue description
When closing the scene preview of a scene that contains only a Camera and Terrain3D node, the Godot console shows:
I have manually compiled the Terrain3D and was able to grab the stack trace in WinDbg:
With this and looking at Godot's
servers/physics_3d/godot_collision_object_3d.h:124
, it looks likeTerrain3D::_destroy_collision()
should check the body shape count before calling intobody_get_shape(_static_body, 0)
here.To confirm, I have added extra information at terrain_3d.cpp:475:
LOG(INFO, "Freeing physics body, shape count ", PhysicsServer3D::get_singleton()->body_get_shape_count(_static_body));
With that change, I see the logs contain the following:
Terrain3D::_destroy_collision: Freeing physics body, shape count 0
I have attached the log without my custom changes. I can try to grab more information if required.
Logs
The text was updated successfully, but these errors were encountered: