Reputation: 13
I'm looking to make a puzzle platformer 2d game in Godot, where the user manipulates the Z axis of the scene to reveal hidden elements of the scene. Before I start making it, I wanted to know if it was possible to use a 2d scene in 3d, and how.
I don't think it's as simple as adding a 2d camera to a 3d scene. It doesn't show any meshes like how I'd like it to. Yet again, it doesn't have to be a mesh, but that's what I've tried.
Pretty much, my questions are: Is it possible for my idea to work? And can it be done in Godot?
Upvotes: 1
Views: 163
Reputation: 40295
The following instructions are not Godot specific. They should not be too hard to implement in a 3D engine, including Godot's.
Use a 3D camera, with projection set to orthographic. The viewing volume will be a right (straight) prism defined by the position of the camera, it size and near and far distances.
Since the projection is orthographic, there will be no perspective, which can give you a 2D appearance.
As you know, anything behind the camera is not rendered, and anything between the camera and the near plane is not rendered either: So anything behind the near plane is not rendered ...
Which means you can manipulate the position of the camera and the near distance to get a cutout of the scene.
Be aware that materials/shader/rendering settings might be set to cull back faces, in other words that the surface the meshes would only be visible from the outside. If you want the surfaces of the meshes to be visible from the inside (e.g. looking from the mesh cut out by the near plane), make sure they are rendered with face culling disabled.
Upvotes: 0