Using Animation Controller and MoveTo
using { /Fortnite.com/Devices/CreativeAnimation }
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/SpatialMath }
# Demonstrates using the animation controller to listen for events on and stop MoveTo animations
animation_controller_example_device := class(creative_device):
@editable
Prop: creative_prop = creative_prop{}
OnBegin<override>()<suspends>:void=
if(PropAnimationController := Prop.GetAnimationController[]):
PropAnimationController.MovementCompleteEvent.Subscribe(HandleMovementComplete)
PropAnimationController.StateChangedEvent.Subscribe(HandleStateChangedEvent)
StartAndStopMoveToExample()<suspends>:void =
# Starts an animation on the prop and changes animation_controller state
spawn. Prop.MoveTo(transform{}, 1.0)
# Wait until MoveTo is half complete
Sleep(0.5)
# Cancel the MoveTo with the animation_controller
if(PropAnimationController := Prop.GetAnimationController[]):
PropAnimationController.Stop()
# Fires when prop animation controller state changes
HandleStateChangedEvent():void =
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.