using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# PLAYER ENTERS -> FIRST PERSON + INPUT — Part 3 of "Scene Graph: Car Primitive".
#
# Getting "into" the car is the moment the experience changes. Two real,
# fully-public mechanisms make it happen:
#
# 1. DETECT ENTRY with a Mutator Zone placed around the car. Its
# `AgentEntersEvent : listenable(agent)` fires when a player walks in, and
# `AgentExitsEvent` fires when they leave. (You can also use a vehicle
# spawner's `AgentEntersVehicleEvent`, but a zone works for our prop "car".)
#
# 2. SWITCH THE VIEW with a Gameplay Camera device. The First-Person flavour,
# `gameplay_camera_first_person_device`, has a public `AddTo(Agent)` that
# pushes a first-person camera onto that player, and `RemoveFrom(Agent)` to
# pop it. So: on enter -> AddTo, on exit -> RemoveFrom.
#
# About input: a creator CANNOT author custom input actions/mappings in Verse
# (those constructors are Epic-internal). What you CAN do is react to input. The
# cleanest public path is an Input Trigger device: configure its key in the
# Details panel, then subscribe to `PressedEvent : listenable(agent)`. Here we
# only honk while the player is in the car — proof the camera switch and the
# input subscription are both live for the right player.
#
# This device uses @editable references (no tags) so you can see exactly which
# zone, camera, and input trigger it drives.
car_first_person_enter_device := class(creative_device):
Verse Library
verse
03 Device
Switches player view to first-person and registers input triggers when an agent enters or exits a zone.
verse-library/verse-car-first-person-enter/03-device.verse
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.