![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | jagc |
I want to have a 2D art background in a 3D world.
I copied everything - all the codes and the properties from the 2D in 3D demo in the asset store but i can’t seem to translate it at all in my project.
This is my node structure
+ game (Node) |-- (other nodes of the project here) |-- viewportQuad (MeshInstance) |-- Viewport | |-- background (2D Node scene)
< background 2D Node scene >
+ background (2D Node) |-- sprite (Sprite) | |-- bgLayer1 (Sprite) | |-- bgLayer2 (Sprite) | |-- bgLayer3 (Sprite) | |-- bgLayer4 (Sprite)
I tried to extract the nodes of the background scene and made the sprites a direct child of the Viewport node but still no luck. I still don’t see anything.
This is the script i copied from the demo.
var viewport = get_node("Viewport") viewport_set_clear_mode(Viewport.CLEAR_MODE_ONLY_NEXT_FRAME) yield(get_tree(), "idle_frame") yield(get_tree(), "idle_frame") get_node("viewportQuad").material_override.albedo_texture = viewport.get_texture()
It’s basically 5 lines of code only so it’s supposed to be straightforward. What am i missing here?
print(viewport.get_texture())
or print_debug(viewport.get_texture())
doesn’t help. It just shows you something like a resource (i don’t know what it is.) Like: [ViewportTexture:1207]
^ Idk how to use that for investigating or debugging.
Maybe there is a different way of seeing a viewport’s texture to debug this?
My Env:
Godot 3.1.1
Demo Env:
Godot 3.0
Not even comments for this one? anyone?
jagc | 2019-06-20 01:19