Events

../../../_images/image-0.png

This section contains events common to all objects. Blocks inside an event are executed immediately when the event occurs. Event blocks can be used multiple times

Object started/finished collision with…

../../../_images/image-111.png

An event that detects the intersection of two objects (object collision) and fulfills the condition it contains

The event has 2 input parameters and 2 local variables:
  1. The main object that is the trigger
  2. The target object to intersect with the main object
  3. First object
  4. Second object

Note

The local variables of the First object and the parameters of the Second object are immutable, but the user can use them to insert them into the internal structure of this event as a variable. You can read more about local variables in the corresponding article

This event has two states: Started and Finished:

  • “Started” - a state that reacts to the beginning of the collision of two objects
  • “Finished” - a state reacting to the moment when two objects finish the collision

Variable N has changed value

../../../_images/image_22.png

An event that checks if the value of the given variable has been changed. If the value is changed, then the blocks inside the event are executed

Note

Old value and New value are immutable local variables, but the user can use them to insert them into the internal structure of this event as a variable. You can read more about local variables in the corresponding article

Scene preparation

../../../_images/image-37.png

A block that performs all actions within itself before starting the project. That is, until the block is executed, the user will have a black loading screen

Note

The duration of the black screen depends on the complexity of the “Scene preparation”, but it usually doesn’t take long

Execute chain at scene launch

../../../_images/image-44.png

The blocks inside this event are executed once at the moment the scene is loaded or the mode is changed to “preview”. This block is convenient to use for the initial initialization of the state of objects in the scene, for example, enable a button, which is disabled by default

Execute chain every N seconds

../../../_images/image-52.png

The content of this event will be executed for the interval specified in the input field until the project is shut down or restarted

When changing the view mode to VR/Desktop

../../../_images/image-63.png

This event reacts to switching the view mode of the project in VR or in Desktop

Usage example

Let’s consider an example of using two seemingly identical blocks, the “Preparing the scene” and “Start the chain at the start of the scene” block. To some extent they are indeed the same, but what then is their difference? Let’s look at an example. Let’s create a new project, go to the scene editor and place two cubes on the stage. For the sake of distinction, we recolor them and name them

../../../_images/image-8.png

After, in the inspector, hide both of these cubes so that we can see the result of the logic execution

Note

You can read more about the 3D scene interface in the corresponding article

Let’s go to the logic editor. Create two events “Prepare scene” and “Run chain at scene start” and put “Activate object” in it from “Objects” - “Any” category. Also, for clarity of the example, place before these two actions the block “Wait for N seconds” from the “Chains” category and set the parameter to 5 seconds

../../../_images/image-72.png

Save the logic and run the project

../../../_images/image-9.gif

The result speaks for itself:

  • The “Scene Preparation” block allows the user to hide all actions performed inside it behind a dark “Scene Preparation” screen, thereby hiding from the user the execution of logical functions that he does not need to see
  • The “Run chain at scene start” block performs the same function, but is executed immediately when the scene is loaded

When starting a project with extensive logic, if you initialize the execution of all functions in the “Run chain at scene start” block, the project will hang for a short period of time at startup to initialize all variables, etc. When initializing the functions in the “Scene preparation” block, the user will see a black screen with a designation and start the project immediately after it disappears without any hangs. Therefore, the initialization of introductory functions and variables is recommended to be placed in the preparation of the scene