![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | ConnyOnny |
For a splitscreen-game I want to render the game from each player’s perspective and arrange these renders next to each other on the screen. I tried to solve this based on the 3D-in-2D-Demo project: Each player has a camera within a viewport. Those viewports’ textures are rendered to sprites. But viewports are capturing, meaning they only render their (direct or indirect) child nodes. But I cannot make the game map a child of both viewports at the same time.
How can I tell the viewports to both render the map?
This is my node structure:
+ Game (regular "Node")
|-- Map (floor, walls etc.)
|-- Players (Spatial)
| |-- Player 1 (Spatial)
| | |-- KinematicBody
| | |-- Viewport
| | |-- Camera
| |-- Player 2 (Spatial)
| (same as Player 1)
|-- Sprite 1
| (using Viewport of Player 1 as texture)
|-- Sprite 2
(using Viewport of Player 2 as texture)
I also tried following this tutorial: https://www.youtube.com/watch?v=WhCQABLmEv0 but it’s for Godot 2 and I cannot get it to work with Godot 3.
I am using Godot 3.0.5 both on Linux x64 and Windows x64.
After grepping through the example projects for “Viewport” I found that the “Interactive Cubes” demo seems to do kind of a splitscreen-implementation. It seems to duplicate the whole scene, but only as a linked Scene, so I guess that is okay and good style? (usually I do OOP or functional; node-based design is still quite new to me)
Anyway, I’ll fiddle around and let you know if I get it working.
ConnyOnny | 2018-07-27 13:32