using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/SpatialMath } # This is our dance floor script. DanceFloor := class(creative_device): # These are our props. They are like actors on a stage. @editable crate_1: creative_prop = creative_prop{} @editable crate_2: creative_prop = creative_prop{} @editable crate_3: creative_prop = creative_prop{} # This function runs when the device starts up. OnBegin(): void = # We subscribe to the trigger's agent-entered event elsewhere, # but here we drive the dance directly on begin for simplicity. RunDance() # Moves all three crates to the center at the same time. RunDance(): void = # We define the target spot. Let's use the center of the island. # vector3 is a point in 3D space. target_spot := vector3{X:=0.0, Y:=0.0, Z:=50.0} # We set the duration. 1.0 second is a good start. Duration := 1.0 # Now we tell each crate to move smoothly using MoveTo. # sync{} runs all three moves at the same time so they dance together. sync: # MoveTo takes a target transform, duration, and easing type. # We build a transform that keeps the prop's rotation but changes position. block: crate_1.MoveTo(target_spot, crate_1.GetTransform().Rotation, Duration) block: crate_2.MoveTo(target_spot, crate_2.GetTransform().Rotation, Duration) block: crate_3.MoveTo(target_spot, crate_3.GetTransform().Rotation, Duration) # All three moves are now done because sync{} waits for every branch. # This is important for timing!