Use global physics for viewport node

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By No_99

In my game project i’m using viewport as a texture output, so i can manipulate texture with custom shader. Using it for making 2d metaballs. But when you use viewport node, the outside physics object can’t interact with inside of the viewport because viewport means another world.
I was trying to understand viewport how create new world for manipulate viewport to instead of creating world using the default world. But i couldn’t understand how it works, i was digging in source codes for 5-6 hours.
Can anyone help me to understand?

Also i found this but this way is a bit long and i couldn’t understand how it works:

Sorry for my english.

I would have thought you could assign the space property of World but this isn’t possible. World2D — Godot Engine (3.1) documentation in English
You should either assign the same world as the global one, or do a feature request to have different visual world (aka scenario) while having the same physics world (aka space).
The only way I know of to do this right now is to not use nodes and use servers directly, or split scenes in two, but that’s surely out of the question given the amount of work.

Zylann | 2020-01-22 13:50