The layer manager
The layer manager… Layer management is very useful for creating new experiences in your project. From visual effects to game mechanics. Welcome to a new tutorial!
1.0 – What is a layer in DarkSpine?
We all know what a layer is in other programs like PhotoShop. Well here is something very similar, but with the nuance that we are working in a 3D environment.
We can group our objects in layers, in this way we will have greater control of what we draw and / or program for them. In this way we get more fluidity in our work environment.
The depth of our objects (on its Z axis), is relative to the depth of the layer (added value in the corresponding layer in our layer panel).
The list of functions is as follows:
- Layer depth: The value in pixels at which we set our layer by default.
- Hide layer: Represented by the icon of an eye, this function makes all objects that are housed in the selected layer invisible.
- Layer lock: If we lock the padlock icon, our objects will stop reacting to the editor interface, their selection being impossible.
- Layer delete: All objects that are in this layer will be destroyed automatically.
1.1 – Creating a layer
In the image below we can see that we have duplicated a family, specifically our land, which is the father of two trees.
Lo que haremos es enviar nuestro objeto hacia otra capa. Para eso añadiremos una nueva capa en nuestro escenario. Abriremos nuestro menú de capas pulsando el botón virtual Layer Menu.
We can observe that a default layer is established, called “Origin of the world”, that exactly that, the first layer with a value of 0 in depth.
The default value of our camera will be the same, as long as we do not select any object … In that case, the camera will take the value of the object’s depth.
Pressing the ADD LAYER virtual button we will add a new layer, a tab leads us to insert an identification name.
We will confirm the creation and we are ready to create or configure new layers.
We will repeat this process depending on the number of layers we want to establish. In this case we will create up to 4 layers and use 3 of them as an example in this tutorial.
1.3 – Setting up the depth of a layer
In the image above, we see how we can adjust an initial value of the layer depth. In this case we adjust 1000 pixels in depth range.
Now if we look at the image below, we have opened the INSPECTOR menu to change the depth of our selected object.
Whenever we assign a value that matches the value of an existing layer, the object will become part of the group of the layer in question. Being relative to the configuration of this.
If we select the new layer, the interface (drawn directly on the screen) and our editor will be positioned to start working at that depth.
As a note, in one layer our objects can have any depth value. This means that we can have a layer positioned at 1000 pixels on its Z axis and as an example our object is 10 units above or below it. Being at a depth of 1010 or 990 respectively.
Here we show a visual example activating the mesh to visualize in context:
As you can see, our white mesh shows where the interface is positioned. When we change the layer, the result is what you see in the image below.
By CLICKING RIGHT on the title, we can drag and sort the layers according to how we want to sort them, by name or as in this example, by depth.
1.4 – Hiding a layer
Click on the icon that represents an eye, hide the layer. That is, all objects belonging to it will be invisible.
1.5 – Destroying a layer
Before we destroy a layer we must confirm the action. This is an irreversible action. Although our editor contains a history system for doing and undoing actions, it will not take this action into account.
We strongly recommend that you view the video located at the beginning of this article to get a clear idea of this section.
The video tutorials provided on the YouTube channel support subtitle contributions from users. This means that any user can contribute to add subtitles with the editor and the new contribution program of YouTube subscribers.
Imagine our editor as if it were a 3D printer, in it sculpt on the X and Y axis. If we wanted to build a tower, the Z axis would be of vital importance.
We would only have to talk about the logical part of contributing to the management of layers, from creating a parallax effect without cost to the CPU, to a customized collision system depending on which layer our player is positioned on. But it is something we will see in later articles.
And so far on the management of layers, a simple tool to handle and with great possibilities to create games of different genres. Such as platform, top-down. shooter, beat’em up and even because not, first-person hybrids … See you in the next article! Greetings!