godotengine / godotengine/godot-cpp
[NativeScript 1.1] Crash attempting to get physics inside of a local resource
- Dominant language
- C++
- Stars
- 2.7k
- Forks
- 809
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 8
Description
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...
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.