Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be 📖

Visual Signals 3D

An asset by Hectarea
The page banner background of a mountain and forest
Visual Signals 3D thumbnail image
Visual Signals 3D thumbnail image
Visual Signals 3D thumbnail image
Visual Signals 3D hero image

Quick Information

0 ratings
Visual Signals 3D icon image
Hectarea
Visual Signals 3D

This plugin lets you create signals with a visual representation. These connections are drawn as well. And, lastly, connecting signals is done via inspector.

Supported Engine Version
4.1
Version String
1.0.0
License Version
Unlicense
Support Level
community
Modified Date
1 year ago
Git URL
Issue URL

Visual Signals 3D

This is a plugin to create visual signals.

README Visual Signals 3D

Introduction

Godot has signals that implements the very known Observer pattern. A signal can be emitted and the observers can react in consecuence.

This plugin adds an extra layer to visualize these signals.

Visual Signals 3D follows an ECS approach (Entity Component System). Each visual signal will be a node. This node must be seen as a component of the current scene. Thus, the current scene will be an object containing one or more components. Then, you can connect the different objects placed in a greater scene.

Visual signals

When talking about signals, there are two sides: The emitter and the receiver. To connect two objects, one object must have an emitter, and the other one a receiver. These emitters and receivers are just nodes. For example, you might have an object with a Signal3DEmitter node, and another with a Signal3DReceiver node. The minimum you must know about these nodes is that emitters have a method named emit (same as normal signals), and receivers have a normal signal called receive_signal. The object with the emitter can emit a signal whenever it wants just by calling the emitter's method emit. On the other side, the object with the receiver can receive that signal just by connecting with the receiver's signal receive_signal.

A signal has a signature. It can receive a specific number of arguments. That's why we can have several types of emitters and receivers. Here is a list with all the signals that come with this plugin:

README Visual Signals 3D nodes

The name of the signal reveals how its signature is. If it has the suffix <number>Param, then the signal has the number of params it sais. For example, Signal3DEmitterTwoParam has 2 parameters. These parameters can be of any type. However, we have signals like Signal3DEmitterBool that has only one parameter of type bool.

As you may already thinking, emitters and receivers can only be connected if they are of the same type. For example, Signal3DEmitterFloat only can be connected with Signal3DReceiverFloat.

Creating visual signals

To show how to create visual signals we are going to follow the next example: We want an object that emits a signal every second with a number increasing at each tick; also, we want an object that will print every number it receives from a signal.

These objects are in this repository inside the example folder.

Creating a signal emitter

First, let's create a new scene called Clock. It has a sprite and a timer. Nothing new for now.

README Creating emitter 1

Now, I'm adding a new Signal3DEmitterInt.

README Creating emitter 2

I'm calling it OnTick.

README Creating emitter 3

Now, we want a script on the root node to manage the timer and, later on, the signal emitter.

README Creating emitter 4

Let's connect the timer's signal.

README Creating emitter 5

The method we will implement should call the emitter's emit method.

README Creating emitter 6

Finally we can adjust the position of our emitter.

README Creating emitter 7

Creating a signal receiver

The nest step is creating an object with a receiver. Let's create a new scene called Printer. It also has a sprite.

README Creating receiver 1

Add a Signal3DReceiverInt.

README Creating receiver 2

I'm calling it Print.

README Creating receiver 3

We want a script to handle the receiving of signals.

README Creating receiver 4

Remember that receivers have a normal signal to let us know when a signal is received. Let's connect it.

README Creating receiver 5

The method to implement just prints the received integer.

README Creating receiver 6

Finally, adjust the receiver position.

README Creating receiver 7

Connecting the signals

With Visual Signals 3D, the receivers are the nodes that are connected to emitters and not viceversa. To illustrate this, let's create a new scene called example. I've added some light and a sky, but feel free to leave it blank.

README Connecting signals 1

Let's instantiate a Clock and a Printer. You will notice that a new node called SignalManager has been created. This node is necessary to handle the connections between emitters and receivers. Also, it is the responsible to draw that connections.

README Connecting signals 2

When selecting an object that contains one or more receivers, it will have extra properties at top of the inspector. A new property is created for each receiver the object contains.

README Connecting signals 3

Clicking on the dropdown will show all the emitters that can be connected to that receiver. Also, a visual line will be drawn to tell us what emitter we are going to connect to.

README Connecting signals 4

Once you select an emitter the connection will be drawn as a white line.

README Connecting signals 5

And that's all! We can run the scene and see the Printer printing the numbers generated by the Clock.

README Connecting signals 6

This plugin lets you create signals with a visual representation. These connections are drawn as well. And, lastly, connecting signals is done via inspector.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Visual Signals 3D icon image
Hectarea
Visual Signals 3D

This plugin lets you create signals with a visual representation. These connections are drawn as well. And, lastly, connecting signals is done via inspector.

Supported Engine Version
4.1
Version String
1.0.0
License Version
Unlicense
Support Level
community
Modified Date
1 year ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers