godotengine / godotengine/godot-cpp

[NativeScript 1.1] Crash attempting to get physics inside of a local resource

Abierto
#175 12 comentarios 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
C++
Estrellas
2.7k
Forks
809
Merge medio
1 d 3 h
PR fusionados (30 d)
8

Descripción

I'm probably stretching the possibilities of time and space here but I'm trying to get access to the physics engine inside of a resource.

So I have the following code:
```
printf("Procedural mesh raycast, obtaining local scene\n");
Node * localscene = get_local_scene();
if (localscene == NULL) {
printf("Procedural mesh raycast, no local scene found, is this a local resource?\n");
return false;
};
printf("Procedural mesh raycast, obtaining viewport\n");
Viewport * vp = localscene->get_viewport();
if (vp == NULL) {
printf("Procedural mesh raycast, Couldn't obtain local viewport\n");
return false;
}
printf("Procedural mesh raycast, obtaining world\n");
Ref world = vp->find_world();
if (world.is_null()) {
printf("Procedural mesh raycast, Couldn't obtain world\n");
return false;
}
printf("Procedural mesh raycast, obtaining state\n");
PhysicsDirectSpaceState * state = world->get_direct_space_state();
if (state == NULL) {
printf("Procedural mesh raycast, Couldn't obtain state\n");
return false;
}
```

Which seems to crash on that final get_direct_space_state() call:
```
Procedural mesh raycast, obtaining local scene
Procedural mesh raycast, obtaining viewport
Procedural mesh raycast, obtaining world
Procedural mesh raycast, obtaining state
ERROR: HashMap,3,8>::get: Condition ' !res ' is true. returned: *res
At: c:\users\basti\development\godot3-git\core\hash_map.h:306
CrashHandlerException: Program crashed
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[0] NativeScriptLanguage::get_instance_binding_data (c:\users\basti\development\godot3-git\modules\gdnative\nativescript\nativescript.cpp:1236)
[1] NativeScriptLanguage::get_instance_binding_data (c:\users\basti\development\godot3-git\modules\gdnative\nativescript\nativescript.cpp:1236)
[2] godot_nativescript_get_instance_binding_data (c:\users\basti\development\godot3-git\modules\gdnative\nativescript\godot_nativescript.cpp:366)
[3] godot_nativescript_init
[4] godot_nativescript_init
[5] godot_nativescript_init
[6] godot_nativescript_init
[7] godot_nativescript_init
[8] godot_nativescript_init
[9] godot_nativescript_init
[10] godot_nativescript_init
[11] godot_nativescript_init
[12] NativeScriptInstance::call (c:\users\basti\development\godot3-git\modules\gdnative\nativescript\nativescript.cpp:736)
[13] Object::call (c:\users\basti\development\godot3-git\core\object.cpp:947)
[14] MessageQueue::_call_function (c:\users\basti\development\godot3-git\core\message_queue.cpp:260)
[15] MessageQueue::flush (c:\users\basti\development\godot3-git\core\message_queue.cpp:307)
[16] SceneTree::iteration (c:\users\basti\development\godot3-git\scene\main\scene_tree.cpp:477)
[17] Main::iteration (c:\users\basti\development\godot3-git\main\main.cpp:1777)
[18] OS_Windows::run (c:\users\basti\development\godot3-git\platform\windows\os_windows.cpp:2605)
[19] widechar_main (c:\users\basti\development\godot3-git\platform\windows\godot_win.cpp:150)
[20] _main (c:\users\basti\development\godot3-git\platform\windows\godot_win.cpp:172)
[21] main (c:\users\basti\development\godot3-git\platform\windows\godot_win.cpp:184)
[22] __scrt_common_main_seh (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283)
[23] BaseThreadInitThunk
-- END OF BACKTRACE --
```

Not sure why...

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Comienza reproduciendo el fallo del NativeScript call a get_direct_space_state() y, después, inspecciona modules/gdnative/nativescript/nativescript.cpp y core/hash_map.h en las ubicaciones del stack trace. Traza por qué el recurso local llega a la búsqueda de binding que falla; el trabajo está terminado cuando la llamada reportada ya no se bloquea y existe una comprobación de regresión.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
cpp
Área
game-dev
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
20/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.