Verse Library verse

03 Determining If A Player Is Idle

Yields one frame to fetch updated character position, enabling reliable movement comparison.

extracted-snippets/documentation/en-us/fortnite/prop-hunt-03-playing-effects-on-idle-players-in-unreal-editor-for-fortnite/03-determining-if-a-player-is-idle.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/prop-hunt-03-playing-effects-on-idle-players-in-unreal-editor-for-fortnite
# Local doc:  epic-docs/documentation/en-us/fortnite/prop-hunt-03-playing-effects-on-idle-players-in-unreal-editor-for-fortnite.md
# Section:    Determining If A Player Is Idle
(PropAgent:agent).AwaitStopMoving(MinimumDistance:float)<suspends>:void=
Logger.Print("Checking if the agent has moved less than the minimum distance.")
# Get the initial position of the agent from the agent's character in the scene.
if (Tracked := PropAgent.GetFortCharacter[]):
var StartPosition:vector3 = Tracked.GetTransform().Translation
Sleep(0.0) # Get the position of the agent in the next game tick.
NewPosition := Tracked.GetTransform().Translation

Comments

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