using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } using { /UnrealEngine.com/Temporary/SpatialMath } # This is our blueprint for any moving object. # It is abstract, so we cannot use it directly. movable_prop := class(): # This is the object we will move. # It is a "creative_prop" in Fortnite terms. # Wire your placed prop to this slot in the Verse Device details panel. Prop: creative_prop = creative_prop{} # This is where we start moving. Start_Position: vector3 = vector3{X := 0.0, Y := 0.0, Z := 0.0} # This is where we want to go. End_Position: vector3 = vector3{X := 0.0, Y := 0.0, Z := 0.0} # This is the specific type of moving object. # It inherits from movable_prop. # It knows how to translate (slide). translating_prop := class(movable_prop): # This function runs once when the game starts. # It sets up the platform. OnBegin(): void = # Start the movement loop on its own thread # so it does not block the rest of the level. spawn { Start_Movement() } # This function makes the prop slide. Start_Movement(): void = # We use a loop to keep moving forever. # A loop repeats code again and again. loop: # Move to the end position. # MoveToTranslation slides the prop smoothly over a given time (in seconds). Prop.MoveTo(End_Position, MakeRotation(vector3{X:=0.0,Y:=0.0,Z:=1.0}, 0.0), 1.0) # Wait one second before moving back. Sleep(1.0) # Move back to the start position. Prop.MoveTo(Start_Position, MakeRotation(vector3{X:=0.0,Y:=0.0,Z:=1.0}, 0.0), 1.0) # Wait one second before moving forward again. Sleep(1.0)