using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Verse.org }
using { /Verse.org/SceneGraph }
using { /Verse.org/SpatialMath }
using { /UnrealEngine.com/Temporary/SpatialMath }
See
for how to create a verse device.
A Verse-authored creative device that can be placed in a level
debug_npc_spawner_device_manager := class(creative_device):@editable NPCSpawnerDevice : npc_spawner_device = npc_spawner_device{}
@editable SpawnAtLocationButtonDevice : button_device = button_device{}
@editable SpawnAtSpawnerButtonDevice : button_device = button_device{}
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
sync:
loop:
InteractAgent := SpawnAtLocationButtonDevice.InteractedWithEvent.Await()
Print("Spawning NPC at location")
Location := GetTransform().Translation.ToLUF()
Rotation := GetTransform().Rotation.ToLUF()
NPCSpawnerDevice.SpawnAt(Location, ?Rotation := option {Rotation})
loop:
InteractAgent := SpawnAtSpawnerButtonDevice.InteractedWithEvent.Await()
Print("Spawning NPC at spawner")
NPCSpawnerDevice.Spawn()
sw_scene_graph_utils — conversion helpers between Verse.org SpatialMath (LUF) and
UnrealEngine.com/Temporary/SpatialMath (XYZ) types.
Entity/SceneGraph APIs (GetGlobalTransform / SetGlobalTransform) use Verse.org
SpatialMath. All arithmetic (ring offsets, TeleportTo, FortChar.GetTransform)
uses UnrealEngine SpatialMath. These extension methods bridge between the two.
Usage example:
Center := LobbyEntity.GetGlobalTransform().FromLUF().Translation # xyz_vec3
── Type aliases ──────────────────────────────────────────────────────────────
luf_vec3 := (/Verse.org/SpatialMath:)vector3xyz_vec3 := (/UnrealEngine.com/Temporary/SpatialMath:)vector3
luf_rot := (/Verse.org/SpatialMath:)rotationxyz_rot := (/UnrealEngine.com/Temporary/SpatialMath:)rotation
luf_xform := (/Verse.org/SpatialMath:)transformxyz_xform := (/UnrealEngine.com/Temporary/SpatialMath:)transform
── vector3 conversions ───────────────────────────────────────────────────────
(Pos : xyz_vec3).ToLUF() : luf_vec3 =FromVector3 of Pos
(Pos : luf_vec3).FromLUF() : xyz_vec3 =FromVector3 of Pos
── rotation conversions ──────────────────────────────────────────────────────
(Rot : xyz_rot).ToLUF() : luf_rot =FromRotation of Rot
(Rot : luf_rot).FromLUF() : xyz_rot =FromRotation of Rot
── transform conversions ─────────────────────────────────────────────────────
(Xform : xyz_xform).ToLUF() : luf_xform =FromTransform of Xform
(Xform : luf_xform).FromLUF() : xyz_xform =FromTransform of Xform
── Convenience: get an entity’s world position as an xyz_vec3 (UnrealEngine)
so callers don’t need to import both SpatialMath modules. ───────────────────
GetEntityWorldXYZ(E : entity) : xyz_vec3 =E.GetGlobalTransform().FromLUF().Translation