# This script defines a prop that moves to a target location. # It uses the MovableProp system to handle the animation. using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } using { /UnrealEngine.com/Temporary/SpatialMath } # Define our class. This is the "Blueprint" for our moving prop. # creative_device gives it a presence on the island and an OnBegin event. LaunchCrate := class(creative_device): # --------------------------------------------------------- # EDITABLE PROPERTIES # These show up in the UEFN Inspector. You can change these # without touching the code. Think of these as your "Device Settings." # --------------------------------------------------------- # The prop that will actually move. # You must drag your Creative Prop from the editor into this slot. @editable RootProp: creative_prop = creative_prop{} # How long (in seconds) the movement takes. # 1.0 = fast, 5.0 = slow float. @editable MoveDuration: float = 2.0 # The target offset added to the prop's starting position (in centimetres). # Z=500 lifts the prop 500 cm (5 metres) straight up. @editable TargetOffset: vector3 = vector3{X:=0.0, Y:=0.0, Z:=500.0} # --------------------------------------------------------- # CORE LOGIC # --------------------------------------------------------- # OnBegin is called automatically when the island session starts. # It is async, so time-based operations like Sleep() and Move() work here. OnBegin(): void = StartMovement() # This function drives the movement. # '' means it can pause and wait without freezing the game — # equivalent to the 'async' concept described above. StartMovement(): void = # Get the prop's current transform (position/rotation/scale). # This is like checking the prop's current GPS coordinates. CurrentTransform := RootProp.GetTransform() # Build the target position by adding TargetOffset to the # prop's current world location. # Think of this as "Keep looking forward, but walk to the new spot." TargetLocation : vector3 = CurrentTransform.Translation + TargetOffset # Construct the destination transform, keeping the original # rotation and scale but swapping in the new location. TargetTransform := transform: Translation := TargetLocation Rotation := CurrentTransform.Rotation Scale := CurrentTransform.Scale # MoveTo animates the prop smoothly from its current transform # to TargetTransform over MoveDuration seconds with a linear curve. # This is the magic line that makes it move smoothly. # '' lets the caller await completion automatically. RootProp.MoveTo(TargetTransform, MoveDuration) # Execution continues here only after the movement finishes. # Optional: Play a sound or spawn particles here when it arrives!