Hi, I wrote a similar question in quick help but to no avail so posting here.
I need to have some rigidbodies under a subviewport because I need to apply a color based shader that wouldn't work with all the other elements.
The problem is that when the nodes are under a subviewport, they don't collide anymore with other static bodies and rigidbodies. Is it by design that nodes under a subviewport can only physically interact with other nodes under the same subviewport or am I doing something wrong?
#Collisions between nodes parented under a subviewport and nodes outside of it - 2D
1 messages · Page 1 of 1 (latest)
This is a 2d viewport in a 2d world right?
You may have to set this property
https://docs.godotengine.org/en/stable/classes/class_viewport.html#class-viewport-property-world-2d
of your viewport to the get_tree().current_scene.get_world_2d()
Mmm... I tried it but the shaders in the subviewport are now applied to all nodes, which defeat the purpose of using the subviewport
But I found a case that sounds quite similar to mine and I will try that solution tomorrow morning https://www.reddit.com/r/godot/comments/bggxd8/2d_multiple_viewports_physics_headache/
So I tried to assign the same world_2D to the subviewport, and I have the same interactions but then I also have the same rendering applied to everything. It seems I can't find a way to separate visual rendering and physics.
Would it work to put the shader on a separate layer with these particular nodes?
I assume you're using a TextureRect and a screen reading shader, is that right? It might work to put the TextureRect on a different visual layer along with the relevant objects. Everything would be part of a single viewport, and you'd want to make sure the viewport was set to render all layers