segunda-feira, 8 de dezembro de 2025

UEFN Verse: Implementing an interface

An interface is a composite type, just like a class, that is used to specify what a class can do without specifying how it will be done. Let's analyze the interface example below.

challengeable := interface:

    IsChallengeCompleted():logic

This code defines the challengeable interface, which has the IsChallengeCompleted() function. Note that the function has no body, as it must be implemented by the class that implements the interface. This example has only one function, but the interface can have as many functions as needed.

Using an interface allows the creation of a type of protocol or contract that can be followed by various classes of different types. Somewhere in the project code, we can handle objects that implement the challengeable interface without needing to know the actual type of the class.

In Verse, implementing an interface is done in the same way as class inheritance. A Verse class can only have one parent class, but it can inherit (implement) multiple interfaces.

In the code below, the trigger_manager_device class inherits from the creative_device class and implements the challengeable interface. It needs to override the IsChallengeCompleted function of the interface.

trigger_manager_device := class(creative_device, challengeable):

    var IsAllTriggersActivated : logic = false

    IsChallengeCompleted<override>():logic=
        IsAllTriggersActivated
		
    ...

Each class that implements the challengeable interface will have its own rules for defining the result of the IsChallengeCompleted() function. The class above considers the challenge completed when all triggers are activated. We could have another class that performs some kind of puzzle using buttons.

The interface type can be used in object reference type conversion, also known as type cast. For example, CreativeDevice is a reference of type creative_device and therefore can point to an instance of any subclass of creative_device.

The code below tests whether the CreativeDevice reference points to an instance of a class that implements the challengeable interface. If the cast works, ChallengeableDevice will store a reference of type challengeable.

if( ChallengeableDevice := challengeable[ CreativeDevice ] ):

	IsChallengeCompleted := ChallengeableDevice.IsChallengeCompleted()

	...

Let's look at an example to illustrate the use of the interface with the trigger_manager_device that implements the challengeable interface.

This device will have 3 trigger_devices. When all trigger_devices are activated, the variable IsAllTriggersActivated receives the value true. The value of this variable is returned in the IsChallengeCompleted() function.

Open Verse Explorer, right-click on the project name and choose the Add new Verse file to project option.

In Device Name put trigger_manager_device and click the Create Empty button.

Let's create the challengeable interface in this same file. Copy the Verse code below into the trigger_manager_device file:

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

challengeable := interface:

    IsChallengeCompleted():logic

trigger_manager_device := class(creative_device, challengeable):

    var IsAllTriggersActivated : logic = false

    @editable
    Trigger1 : trigger_device = trigger_device{}

    @editable
    Trigger2 : trigger_device = trigger_device{}

    @editable
    Trigger3 : trigger_device = trigger_device{}

    OnBegin<override>()<suspends>:void=
        sync:
            Trigger1.TriggeredEvent.Await()
            Trigger2.TriggeredEvent.Await()
            Trigger3.TriggeredEvent.Await()

        set IsAllTriggersActivated = true   

    IsChallengeCompleted<override>():logic=
        IsAllTriggersActivated

In the OnBegin function, the sync expression is used to wait until all triggers are activated.

Save the file and compile the Verse code using the Verse > Compile Verse Code option from the UEFN menu.

Let's create another device that will use the IsChallengeCompleted() function from the challengeable interface to check if the challenge has been completed and activate the end_game_device.

In Verse Explorer, right-click the project name and choose the option Add new Verse file to project.

In Device Name, put interface_device and click the Create Empty button.

Copy the Verse code below into the interface_device file:

using { /Fortnite.com/Devices }
using { /Fortnite.com/Playspaces }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

interface_device := class(creative_device):
    
    @editable
    CreativeDevice : creative_device = creative_device{}

    @editable
    EndGameDevice : end_game_device = end_game_device{}
    
    OnBegin<override>()<suspends>:void=

        if( ChallengeableDevice := challengeable[ CreativeDevice ] ):

            loop:
                IsChallengeCompleted := ChallengeableDevice.IsChallengeCompleted()

                if: 
                    IsChallengeCompleted?
                    PlayerAgent := GetPlayspace().GetPlayers()[0]
                then:
                    EndGameDevice.Activate(PlayerAgent)
                    break   #end loop

                Sleep(0.5)
        else:
            Print("The device doesn't implement the challengeable interface!")        

We are using a reference to creative_device, which is the parent class of creative devices. Therefore, this example will work for any type of device that implements the challengeable interface.

The OnBegin() function checks if we have an instance that implements the challengeable interface. Then a loop is started that checks every 0.5 seconds if the challenge has been completed.

Save the file and compile the Verse code using the Verse > Compile Verse Code option from the UEFN menu.

Access the Content Drawer and add the trigger_manager_device and interface_device to the level.

Add one End Game Device and three Trigger Devices to the level. The image below shows the devices used in this example.


Select the trigger_manager_device at the level. In the Details tab, select the 3 instances of Trigger Device.


Select the interface_device at the level. In the Details tab, add the references for the trigger manager device and the End Game Device.


Save the level and click the Launch Session button to load the level in Fortnite. After activating the 3 triggers, the interface_device will detect that the challenge has been completed and will trigger the end of the match.

UEFN Verse: Implementando uma interface

Uma interface é um tipo composto, assim como a classe, que é usada para especificar o que uma classe pode fazer sem especificar como será feito. Vamos analisar o exemplo abaixo de interface.

challengeable := interface:

    IsChallengeCompleted():logic

Este código define a interface challengeable que possui a função IsChallengeCompleted(). Observe que a função não tem corpo, pois ela tem de ser implementada pela classe que implementar a interface. Este exemplo possui apenas uma função, mas a interface pode ter quantos funções forem necessárias.

O uso de interface permite a criação de um tipo de protocolo ou contrato que pode ser seguido por diversas classes de diferentes tipos. Em alguma parte do código do projeto nós podemos lidar com objetos que implementam a interface challengeable sem precisar saber do tipo real da classe.

Em Verse, a implementação de uma interface é feita da mesma forma que a herança de classe. Uma classe Verse só pode ter uma classe pai, mas pode herdar (implementar) diversas interfaces.

No código abaixo, a classe trigger_manager_device herda da classe creative_device e implementa a interface challengeable. Ela precisa sobrescrever a função IsChallengeCompleted da interface.

trigger_manager_device := class(creative_device, challengeable):

    var IsAllTriggersActivated : logic = false

    IsChallengeCompleted<override>():logic=
        IsAllTriggersActivated
		
    ...

Cada classe que implementar a interface challengeable terá suas próprias regras para definir o resultado da função IsChallengeCompleted(). A classe acima considera que completou o desafio (challenge) quando todas as triggers forem ativadas. Podemos ter outra classe que faz algum tipo de puzzle usando botões.

O tipo da interface pode ser usada na conversão de tipo de referências de objetos, também conhecido como type cast. Por exemplo, CreativeDevice é uma referência do tipo creative_device e por isso pode apontar para uma instância de qualquer subclasse de creative_device

O código abaixo testa se a referência CreativeDevice aponta para uma instância de uma classe que implementa a interface challengeable. Se o cast funcionar, ChallengeableDevice armazenará uma referência do tipo challengeable.

if( ChallengeableDevice := challengeable[ CreativeDevice ] ):

	IsChallengeCompleted := ChallengeableDevice.IsChallengeCompleted()

	...


Vamos fazer um exemplo para ilustrar o uso da interface com o dispositivo trigger_manager_device que implementa a interface challengeable.

Este dispositivo terá 3 trigger_device. Quando todas as trigger_device forem ativadas, a variável IsAllTriggersActivated recebe o valor true. O valor desta variável é retornada na função IsChallengeCompleted().

Abra o Verse Explorer, clique com o botão-direito no nome do projeto e escolha a opção Add new Verse file to project.

Em Device Name coloque trigger_manager_device e clique no botão Create Empty.

Vamos criar a interface challengeable neste mesmo arquivo. Copie o código Verse abaixo para o arquivo trigger_manager_device:

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

challengeable := interface:

    IsChallengeCompleted():logic

trigger_manager_device := class(creative_device, challengeable):

    var IsAllTriggersActivated : logic = false

    @editable
    Trigger1 : trigger_device = trigger_device{}

    @editable
    Trigger2 : trigger_device = trigger_device{}

    @editable
    Trigger3 : trigger_device = trigger_device{}

    OnBegin<override>()<suspends>:void=
        sync:
            Trigger1.TriggeredEvent.Await()
            Trigger2.TriggeredEvent.Await()
            Trigger3.TriggeredEvent.Await()

        set IsAllTriggersActivated = true   

    IsChallengeCompleted<override>():logic=
        IsAllTriggersActivated

Na função OnBegin é usado a expressão sync para aguardar até que todas as triggers sejam ativadas.

Salve o arquivo e compile o código Verse usando a opção Verse > Compile Verse Code do menu do UEFN.

Vamos criar outro dispositivo que usará a função IsChallengeCompleted() da interface challengeable para verificar se o desafio foi concluído e ativar o end_game_device.

NVerse Explorer, clique com o botão-direito no nome do projeto e escolha a opção Add new Verse file to project.

Em Device Name coloque interface_device clique no botão Create Empty.

Copie o código Verse abaixo para o dispositivo interface_device:

using { /Fortnite.com/Devices }
using { /Fortnite.com/Playspaces }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

interface_device := class(creative_device):
    
    @editable
    CreativeDevice : creative_device = creative_device{}

    @editable
    EndGameDevice : end_game_device = end_game_device{}
    
    OnBegin<override>()<suspends>:void=

        if( ChallengeableDevice := challengeable[ CreativeDevice ] ):

            loop:
                IsChallengeCompleted := ChallengeableDevice.IsChallengeCompleted()

                if: 
                    IsChallengeCompleted?
                    PlayerAgent := GetPlayspace().GetPlayers()[0]
                then:
                    EndGameDevice.Activate(PlayerAgent)
                    break   #end loop

                Sleep(0.5)
        else:
            Print("O dispositivo não implementa a interface challengeable!")        

Estamos usando uma referência para creative_device que é a classe pai dos dispositivos criativos. Então este exemplo vai funcionar para qualquer tipo de dispositivo que implemente a interface challengeable.

Na função OnBegin() é verificado se temos uma instância que implementa a interface challengeable. Depois é iniciado um loop que verifica a cada 0,5 segundos se o desafio foi concluído. 

Salve o arquivo e compile o código Verse usando a opção Verse > Compile Verse Code do menu do UEFN. 

Acesse o Content Drawer e adicione os dispositivos trigger_manager_device e interface_device ao nível. 

Adicione um End Game Device e três Trigger Device no nível. A imagem abaixo mostra os dispositivos usados neste exemplo.


Selecione o trigger_manager_device no nível. Na aba Details, selecione as 3 instâncias de Trigger Device.


Selecione o interface_device no nível. Na aba Details adicione as referências do trigger manager device e do End Game Device.


Salve o nível e clique no botão Launch Session para carregar o nível no Fortnite. Após ativar as 3 triggers, o interface_device detectará que o desafio foi concluído e ativará o fim da partida.


sexta-feira, 5 de dezembro de 2025

UEFN Verse SG: Creating a Scene Graph component

In this article, we will create a simple Scene Graph component that will help us understand the relationship between entity, component, and Prefab.

Our component will generate a sort of platform bridge. It will have two fields that will be used to define the number of platforms generated and the distance between them.

The image below shows the platform bridge that will be generated:


We'll use UEFN's modeling mode to create a mesh that will serve as the platform. Change the editor to Modeling mode:


In the modeling panel, select the Cylinder shape:


Change the Cylinder Height to 50 and select a material. I chose the MI_Japanese_Wooden_Floor material.


Click on the level to position the mesh, and then click the Accept button to create the mesh.



In the Content Drawer, you'll see that a folder called Meshes has been created inside your project folder. Access the folder, select the mesh, and press F2 to rename it. Rename the Static Mesh to Platform_cylinder. Double-click the mesh to open the static mesh editor.

We need to add collision to the mesh. Let's use a simple shape. In the Collision menu, choose the Add Box Simplified Collision option. Save and close the editor.


It is necessary to compile the Verse code in order to create the mesh component in Verse that represents the mesh we created. To compile, go to the menu Verse > Compile Verse Code.


Now let's create the Prefab that will represent a platform. Access the Content Drawer, select your project folder, and right-click on an empty space to open the menu. Select Entity Prefab Definition and name this as Prefab_platform.



Double-click the Prefab_platform that was created to open the Prefab editor. In the Details tab, click the +Component button and select the transform_component. This component is necessary to define the position, rotation, and scale of the entity at the level.


Add another component and select the mesh_component. The mesh components available in the project will be displayed. Select the Platform_cylinder that we created.


The image below from the Prefab editor shows what the Prefab_platform looks like.



Save the Prefab and close the Prefab editor.

When we create a Prefab, UEFN creates a Verse class from this Prefab and registers it in the Assets.digest.verse file. This allows the creation of Prefab instances directly in the Verse code.

The next step is to create the Scene Graph component, which will generate multiple instances of Prefab_platform in different positions and add them to the entity that owns the component.

Open Verse Explorer, right-click on the project name, and select the option Add new Verse file to project.

Choose the Scene Graph Component template and name it platform_row_component. Click the Create Empty button.


Double-click the platform_row_component file to open it in Visual Studio Code.

Copy the Verse code below into the platform_row_component file:

using { /Verse.org }
using { /Verse.org/Native }
using { /Verse.org/SceneGraph }
using { /Verse.org/Simulation }
using { /Verse.org/SpatialMath }

platform_row_component<public> := class<final_super>(component):

    @editable
    NumberOfPlatforms<public>:int = 10

    @editable
    PlatformDistance<public>:float = 300.0

    OnBeginSimulation<override>():void =
        # Run OnBeginSimulation from the parent class
        (super:)OnBeginSimulation()

        for (Index := 0..NumberOfPlatforms - 1):
            Position := vector3{Forward := PlatformDistance * Index}

            NewPlatform := Prefab_platform{}

            NewPlatform.SetLocalTransform( transform{Translation := Position} )
            
            Entity.AddEntities( array{NewPlatform} )        
             
    OnSimulate<override>()<suspends>:void =
        Print("OnSimulate")


Let's analyze this code piece by piece. The line below declares that platform_row_component is a class that inherits from the component class. In other words, component is the parent class and is also known as the superclass.

platform_row_component<public> := class<final_super>(component): 

The <public> specifier indicates that the class will be available everywhere. The <final_super> specifier is a requirement of the Scene Graph to ensure the integrity of the system of entities and components.

Our component has two fields that can be edited directly in UEFN to configure the generation of the platform bridge.
    @editable
    NumberOfPlatforms<public>:int = 10

    @editable
    PlatformDistance<public>:float = 300.0

These fields use the <public> specifier to make them visible to other components. In Scene Graph programming, interaction between components is very common, so using constants with <public> access facilitates access to this data without the risk of it being modified by other components.

The Scene Graph component template code provides two functions where you can place the code that will be executed when the simulation starts:
  •  OnBeginSimulation<override>( ) : This function executes and completes immediately. Ideal for component preparation code that will only be executed once.
  •  OnSimulate<override>()<suspends> The <suspends> specifier indicates that this is an asynchronous function, meaning its completion does not need to be immediate. For example, here you can place code that makes the component wait for player interaction.

The code for generating the platform bridge is in the OnBeginSimulation<override> function. Right at the beginning of this function, we have the following line of code:
    (super:)OnBeginSimulation()

The component class, which is used as a superclass for the components, has an OnBeginSimulation() function that requires some configuration code to be executed. The (super:) indicates that the OnBeginSimulation() function to be executed is from the superclass.

The for expression is used to repeat its code block for each platform that will be generated. The value of Index is modified for each iteration of the for loop. The first value is 0 and the last value will be NumberOfPlatforms - 1.
    for (Index := 0..NumberOfPlatforms - 1): 

Inside the for loop, the Index value is used to calculate the position where the new Prefab_platform instance will be created.

Position := vector3{Forward := PlatformDistance * Index} 

This position is relative to the position of the entity that will contain our component. The platforms will be created following the Forward axis. To change the direction in which the platform bridge will be created, simply rotate the entity at the level.

Note: Since version 36.00, UEFN has used the LUF coordinate system. In this system, the coordinate axes are Left, Up, and Forward. To learn more about LUF, please refer to this Epic Games documentation: 

Left-Up-Forward Coordinate System


The constant NewPlatform stores a new instance of our Prefab_platform:

NewPlatform := Prefab_platform{} 


The SetLocalTransform() function specifies the platform relative transformation. In our example, you only need to set the Translation field of the transform. Rotation and scale use the default values.

NewPlatform.SetLocalTransform( transform{Translation := Position} ) 


The new instance of Prefab_platform needs to be added to the entity that contains our component. The component class has the constant Entity, which is a reference to this entity. The AddEntities function adds an array of entities to an entity. Therefore, it was necessary to create an array containing the instance referenced by NewPlatform.

Entity.AddEntities( array{NewPlatform} )


These actions are repeated for each iteration of the for loop.

Save the file and compile the Verse code using the Verse > Compile Verse Code option from the UEFN menu.

To complete this example, we need to add an entity at the level and add our platform_row_component to this entity. Follow these steps:

1. In UEFN, access the Place Actors panel. If the panel is not visible, access it in the top Window menu.

2. In Place Actors, select the Entities category and drag an entity to the level. In the Outliner tab, rename this new entity to PlatformBridge for easier identification.

3.  In the Details tab, click the +Component button and select our platform_row_component.


4. In the Details tab, you can modify the values ​​that are used in generating the platform bridge.


5. Position the entity slightly above the floor level to prevent the platform bridge from being created on the floor.


Save the level and load it in Fortnite by clicking the Launch Session button to see the platform bridge generated by our component.


Note: Unfortunately, the collision of platforms generated by the Verse code is not working correctly. My idea with this example was for the player to jump on the platforms to get across a chasm. However, the player is unable to stand on the platform.

The created Prefab is correct. If we add an instance of the Prefab directly to the level using UEFN, the collision works correctly and the player can stand on the platform.

I researched this situation online and confirmed that the Verse code is correct. I found the following item on an Epic Games page about Scene Graph issues:




This is the problem that must be occurring with our example. Scene Graph is still in Beta and they should fix this problem soon.
(December 2025) 


Table of Contents Verse  

UEFN Verse SG: Criando um componente Scene Graph

Neste artigo vamos criar um simples componente Scene Graph que irá nos ajudar a entender a relação entre entidade, componente e Prefab.

O nosso componente irá gerar uma espécie de ponte de plataformas. Ele terá dois campos que serão usados para definir o número de plataformas geradas e a distância entre elas.

A imagem abaixo mostra a ponte de plataformas que será gerada:


Vamos usar o modo de modelagem do UEFN para criar uma mesh que será a plataforma. Mude o editor para modo Modeling:


No painel de modelagem, seleciona a forma Cylinder:


Mude a altura (Height) do Cylinder para 50 e selecione algum material. Eu escolhi o material MI_Japanese_Wooden_Floor.


Clique no nível para posicionar o mesh e depois clique no botão Accept para criar o mesh.



No Content Drawer, veja que foi criada a pasta Meshes dentro da pasta do seu projeto. Acesse a pasta, selecione o mesh e pressione F2 pra renomear. Renomeie o Static Mesh para Platform_cylinder. De dois cliques no mesh para abrir o static mesh editor.

Precisamos adicionar colisão na mesh. Vamos usar uma forma simples. No menu Collision, escolha a opção Add Box Simplified Collision. Salve e feche o editor.


É necessário compilar o código verse para que seja criada o mesh component em Verse que representa o mesh que criamos.  Para compilar acesse o menu Verse > Compile Verse Code.


Agora vamos criar o Prefab que representará uma plataforma. Acesse o Content Drawer, selecione a pasta do seu projeto e clique com o botão direito e um espaço vazio para abrir o menu. Selecione Entity Prefab Definition e coloque o nome Prefab_platform para este Prefab.



Dê dois cliques no
Prefab_platform que foi criado para abrir o editor de Prefab. Na aba Details, clique no botão +Component e selecione o transform_component. Este componente é necessário para definir a posição, rotação e escala da entidade no nível.


Adicione outro componente e selecione o mesh_component. Serão exibidos os mesh_components disponíveis no projeto. Selecione o Platform_cylinder que criamos.


A imagem abaixo do editor do Prefab mostra como ficou o Prefab_platform.



Salve o Prefab e feche o editor Prefab.

Quando criamos um Prefab, o UEFN cria uma classe Verse deste Prefab e registra no arquivo Assets.digest.verse. Isto permite a criação de instâncias do Prefab direto no código Verse.

O próximo passo é a criação do componente Scene Graph que irá gerar várias instâncias do Prefab_platform em posições diferentes e adicioná-las à entidade que possui o componente. 

Abra o Verse Explorer, clique com o botão-direito no nome do projeto e escolha a opção Add new Verse file to project

Escolha o template Scene Graph Component e coloque o nome platform_row_component. Clique no botão Create Empty.


Dê um duplo clique no arquivo platform_row_component para abri-lo no Visual Studio Code.

Copie o código Verse abaixo para o componente platform_row_component:

using { /Verse.org }
using { /Verse.org/Native }
using { /Verse.org/SceneGraph }
using { /Verse.org/Simulation }
using { /Verse.org/SpatialMath }

platform_row_component<public> := class<final_super>(component):

    @editable
    NumberOfPlatforms<public>:int = 10

    @editable
    PlatformDistance<public>:float = 300.0

    OnBeginSimulation<override>():void =
        # Run OnBeginSimulation from the parent class
        (super:)OnBeginSimulation()

        for (Index := 0..NumberOfPlatforms - 1):
            Position := vector3{Forward := PlatformDistance * Index}

            NewPlatform := Prefab_platform{}

            NewPlatform.SetLocalTransform( transform{Translation := Position} )
            
            Entity.AddEntities( array{NewPlatform} )        
             
    OnSimulate<override>()<suspends>:void =
        Print("OnSimulate")


Vamos analisar este código por partes. A linha abaixo está declarando que platform_row_component é uma classe que herda da classe component. Ou seja, component é a classe pai e também é conhecida como a superclasse.

platform_row_component<public> := class<final_super>(component): 

O especificador <public> indica que a classe estará disponível em toda parte. O especificador <final_super> é uma exigência do Scene Graph para garantir a integridade do sistema de entidades e componentes.

O nosso componente possui dois campos que podem ser editados direto no UEFN para configurar a geração da ponte de plataformas.
    @editable
    NumberOfPlatforms<public>:int = 10

    @editable
    PlatformDistance<public>:float = 300.0

Estes campos usam o especificador <public> para que fiquem visíveis para outros componentes. Na programação com Scene Graph, a interação entre componentes  é muito comum, por isso o uso de constantes com acesso <public> facilita o acesso a estes dados sem correr o risco deles serem modificados por outros componentes.

O código de template do Scene Graph componente traz duas funções onde você pode colocar o código que será executado ao iniciar a simulação:
  •  OnBeginSimulation<override>( ) : Esta função tem execução e conclusão imediata. Ideal para códigos de preparação do componente que serão executados somente um vez. 
  •  OnSimulate<override>()<suspends> : O especificador <suspends> indica que esta é uma função assíncrona, ou seja sua conclusão não precisa ser imediata. Por exemplo, aqui você pode colocar um código que faz o componente aguardar uma interação do jogador.

O código de geração da ponte de plataforma está na função OnBeginSimulation<override>. Logo no início desta função, temos a seguinte linha de código:
    (super:)OnBeginSimulation()

A classe component que é usada como superclasse dos componentes, possui a função OnBeginSimulation() que deve ter algum código de configuração que deve ser executado. O (super:) indica que a função OnBeginSimulation() que será executada é a da superclasse.

A expressão for é usada para repetir o seu bloco de código para cada plataforma que será gerada. O valor de Index é modificado para cada iteração do for. O primeiro valor é 0 e o último valor será NumberOfPlatforms - 1.
    for (Index := 0..NumberOfPlatforms - 1): 

Dentro do laço for é usado o valor de Index para calcular a posição onde a nova instância do Prefab_platform será criada.

Position := vector3{Forward := PlatformDistance * Index} 

Esta posição é relativa à posição da entidade que terá o nosso componente. As plataformas serão criadas seguindo o eixo Forward. Para mudar a direção que a ponte de plataformas será criada, basta rotacionar a entidade no nível.

Nota: Desde a versão 36.00, a UEFN passou a usar o sistema de coordenada LUF. Neste sistema os eixos de coordenadas são Left, Up e Forward. Para saber mais sobre o LUF, acesse esta documentação da Epic Games:

Left-Up-Forward Coordinate System


A constante NewPlatform armazena uma nova instância do nosso Prefab_platform:

NewPlatform := Prefab_platform{} 


A função SetLocalTransform() especifica a transformação relativa da plataforma. Em nosso exemplo, só precisa definir o campo Translation do transform. A rotação e escala usam os valores padrões.

NewPlatform.SetLocalTransform( transform{Translation := Position} ) 


A nova instância do Prefab_platform precisa ser adicionada à entidade que contém o nosso componente. A classe component possui a constante Entity que é uma referência à esta entidade. A função AddEntities adiciona um array de entidades à uma entidade. Por isso foi preciso criar um array contendo a instância referenciada por NewPlatform.

Entity.AddEntities( array{NewPlatform} )


Estas ações são repetidas para cada iteração do laço for.

Salve o arquivo e compile o código Verse usando a opção Verse > Compile Verse Code do menu do UEFN. 

Para concluir este exemplo é preciso adicionar uma entidade ao nível e adicionar o nosso componente platform_row_component à esta entidade. Siga estes passos:

1. No UEFN, acesse o painel Place Actors. Se o painel não estiver visível, acesse ele pelo menu superior Window.

2. Em Place Actors, selecione a categoria Entities e arraste o entity para o nível. Na aba Outliner, renomeie esta nova entidade para PlatformBridge para facilitar a identificação.

3.  Na aba Details, clique no botão +Component e selecione o nosso componente platform_row_component.


4. Na aba Details, você pode modificar os valores que são usados na geração da ponte de plataformas.


5. Posicione a entidade um pouco acima do piso do nível para evitar que a ponte de plataformas seja criada no piso.


Salve o nível e carregue no Fortnite clicando no botão Launch Session para ver a ponte de plataformas gerada pelo nosso componente. 


Nota: Infelizmente, não está funcionando corretamente a colisão das plataformas que foram geradas pelo código Verse. A minha ideia com este exemplo era para o jogador pular nas plataformas para conseguir passar por algum abismo. Só que o jogador não consegue ficar em cima da plataforma. 

O Prefab criado está correto. Se adicionarmos uma instância do Prefab direto no nível pelo UEFN, a colisão funciona corretamente e o jogador consegue ficar em cima da plataforma.

Pesquisei na internet sobre essa situação e confirmei que o código Verse está correto. Encontrei em uma página da Epic Games sobre problemas do Scene Graph o seguinte item:



Este é o problema que deve estar ocorrendo com nosso exemplo. O Scene Graph ainda está em Beta e logo eles devem corrigir este problema.
(Dezembro de 2025)