Verse Library verse

01 Device

Connects a trigger volume to a light device to dynamically illuminate doors on player entry.

verse-library/materials-tutorials/01-device.verse

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

# This is our main device. It controls the door.
# It watches a trigger_device and changes a
# customizable_light_device to simulate a glowing door.
glowing_door_device := class(creative_device):

    # A reference to the trigger placed in front of the door.
    # Wire this up in the UEFN editor.
    @editable
    EnterTrigger : trigger_device = trigger_device{}

    # A reference to a customizable light device on the door.
    # Use a customizable_light_device to fake the glow effect.
    # note: Verse cannot write directly to mesh materials at runtime;
    # a customizable_light_device is the closest real API for
    # changing color on a prop dynamically.
    @editable
    DoorLight : customizable_light_device = customizable_light_device{}

    # OnBegin runs once when the game starts.
    # We subscribe to the trigger events here.
    OnBegin<override>()<suspends> : void =
        # Subscribe to player-enter and player-leave events
        # on the trigger device.
        EnterTrigger.TriggeredEvent.Subscribe(OnPlayerEnter)

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