Procedurally Animated Conveyor Belt
using { /Fortnite.com/Devices }
using { /Fortnite.com/Devices/CreativeAnimation }
using { /Fortnite.com/Game }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Verse.org/Simulation }
# Makes a scalar value go back to 0.0 if it exceeds 1.0
(Number : float).WrapAroundScalar<public>() : float =
if(Result := Number - (Floor[Number] * 1.0)) then return Result else return Number
# Helper extension function to convert an int to float
(Input : int).ToFloat<public>()<computes> : float = Input * 1.0
ConveyorBelt := class(creative_device):
@editable
Planks : []creative_prop = array{}
# Store the first and last locations in the array of planks
var StartConveyor : vector3 = vector3{}
var EndConveyor : vector3 = vector3{}
# Set the constants for the procedural animation
@editable
TotalMoveTime : float = 30.0
RefreshRate : float = 1.0 / 30.0
OnBegin<override>()<suspends>:void =
InitializeStartPositions()
MovePlanks()
InitializeStartPositions():void =
if (StartPlank := Planks[0], EndPlank := Planks[Planks.Length-1]):
set StartConveyor = StartPlank.GetTransform().Translation
set EndConveyor = EndPlank.GetTransform().Translation
else:
Print("InitializeStartPositions: Error initializing planks. Make sure your Planks array is setup.")
You're reading a preview
The full reference is free for BrainDeadGuild Discord members — sign in to read it all, or open the original at the source.
Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.