Verse Libraryverse

02 Debug

Defines a scene graph component that listens to remote control device signals to teleport a player to a target location.

extracted-snippets/community/learning/tutorials/raZD/fortnite-scene-graph-tutorial/02-debug.verse

# Source URL: https://dev.epicgames.com/community/learning/tutorials/raZD/fortnite-scene-graph-tutorial
# Local doc:  epic-docs/community/learning/tutorials/raZD/fortnite-scene-graph-tutorial.md
# Section:    Debug
using { /Verse.org }
using { /Verse.org/Native }
using { /Verse.org/SceneGraph }
using { /Verse.org/Simulation }
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/SpatialMath }
using { /UnrealEngine.com/Temporary/SpatialMath }

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

    @editable CondButton_Remocon : conditional_button_device = conditional_button_device{}
    @editable RemoconManager : signal_remote_manager_device = signal_remote_manager_device{}

    var IsTeleportPos : ?(/Verse.org/SpatialMath:)vector3 = false
    var PortalE : entity = entity{}

    OnSimulate<override>()<suspends>:void =
        set PortalE = entity{}
        RemoconManager.PrimarySignalEvent.Subscribe(OnSignal_Fire)
        RemoconManager.SecondarySignalEvent.Subscribe(OnSignal_Aim)

    OnSignal_Fire(Agent :agent):void=
        if :
            Char : fort_character = Agent.GetFortCharacter[]
            TeleportPos : (/Verse.org/SpatialMath:)vector3 = IsTeleportPos?
            Char.TeleportTo[FromVector3(TeleportPos), Char.GetTransform().Rotation]

Sign in free to read the full source 🌴

This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.

Sign in with Discord

Comments

    Sign in to vote, comment, or suggest an edit.Sign in