Godot 4.2
Background:
In my game prototype, I have a following player entity:
Paperdoll2D has a script that dynamically adds the weapon/armor/etc Sprite2D nodes to the main sprite to "dress-up" the character in-game, similar to this:
The game is 3D with flat textures used to represent in-game objects (thinks original Doom, Daggerfall etc).
Problem statement:
I would like the Player3D to have such a texture (for cutscenes, 3rd person etc). Already, the Paperdoll2D node basically composes a complete 2D texture with equipped gear and whatnot, so it makes sense to use it to produce a Sprite3D texture.
Suppose the green outline on the image above is the "Screenshot area". That area (and only that area of the 2D screen) is rendered to a texture and applied as a texture to the Sprite3D (non-realtime, only on demand).
Viewports would be great for this because they can "screenshot" the Paperdoll2D and provide a ViewportTexture for use in Sprite3D.
The problem is, to me Viewports were always non-intuitive. Every tutorial on YT and the official Documentation on Viewports lists the following method to have Viewport actually display something:
It works, but all the "active" nodes (sprites, player, etc.) have to be "inside" the viewport. Also, it's very unwieldy - any children of the viewport cannot be moved, scaled, rotated, or anything. Moreover, it unnecessarily complicates the tree structure making it frustrating to work with.
How do I implement this without having to have the viewport inside the Player3D node or having to .reparent the Paperdoll2D to the viewport outside?






