[Bug]: Can't Draw In Viewports that use thier own worlds
lucidium4 opened this issue · comments
Godot version
v4.2.1.stable.official [b09f793f5]
DebugDraw3D version
1.3.1
On which operating systems the error occurs
Windows
Using which renderers the error occurs
Vulkan mobile
Issue description
Debug Draw 3D Can't be use in Viewport that have thier on worlds.
Steps to reproduce
Run the project with the "Own World 3D" variable on and off on the SubViewport
Minimal reproduction project
This is expected, because in order to draw graphics, it needs to be added to some of the worlds. By default, the world of the root of the game is used.
I already have a method that changes the world for all meshes, but only 1 world can be selected. This method only needs to be exposed.
At the moment, a separate mesh is being created for each shape, there are 19 in total. +1 for lines. There is also a division into _process
and _physics_process
. That is, (19 + 1) * 2 meshes are created for one world.
I think it's not very difficult to add support for other worlds, but it will probably reduce performance a little more. And somehow you need to specify the world in which to draw (scoped configs are most likely).
I have added the ability to change World3D for the entire geometry. You can check how set_world_3d_from_viewport
works using binaries from here.
The next goal is to be able to render to multiple Worlds at the same time, but I'm not completely sure how this will be implemented.
fixed #42