Verse Library verse

03 Complete Code

Defines a component class for editor-exposed keyframed entity movement with simulation lifecycle methods.

extracted-snippets/documentation/en-us/fortnite/keyframed-movement-component-in-unreal-editor-for-fortnite/03-complete-code.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/keyframed-movement-component-in-unreal-editor-for-fortnite
# Local doc:  epic-docs/documentation/en-us/fortnite/keyframed-movement-component-in-unreal-editor-for-fortnite.md
# Section:    Complete Code
using { /Verse.org }
using { /Verse.org/Native }
using { /Verse.org/Simulation }
using { /Verse.org/SpatialMath }
using { /Verse.org/SceneGraph/KeyframedMovement }
using { /Verse.org/SceneGraph }
# A Verse-authored component that can be added to entities
move_cycle_component<public> := class<final_super>(component):
# A custom variable you can expose to the editor
@editable
var MyCustomInt<public>:int = 10
@editable
var Keyframes:[]keyframed_movement_delta = array{}
# Runs when the component should start simulating in a running game.
OnBeginSimulation<override>():void =
# Run OnBeginSimulation from the parent class before
# running this component's OnBeginSimulation logic
(super:)OnBeginSimulation()
# TODO: Place logic to run when the component starts simulating here
Print("OnBeginSimulation")
# Runs when the component should start simulating in a running game.
# Can be suspended throughout the lifetime of the component. Suspensions
# will be automatically canceled when the component is disposed of or the game ends.
OnSimulate<override>()<suspends>:void =
# TODO: Place simple suspends logic to run for this component here
Print("OnSimulate")
if:

Sign in free to read the full source 🌴

This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.

Sign in with Discord

Comments

    Sign in to vote, comment, or suggest an edit. Sign in