-
-
Save MiklosMatyas/94d11ea0d791aeae78baf72653ec480f to your computer and use it in GitHub Desktop.
Get closest player to prop in UEFN and Verse
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using { /Fortnite.com/Devices } | |
using { /Fortnite.com/Characters } | |
using { /Verse.org/Simulation } | |
using { /UnrealEngine.com/Temporary/Diagnostics } | |
using { /UnrealEngine.com/Temporary/SpatialMath } | |
GetClosestPlayerToProp(AllPlayers: []fort_character, Prop : creative_prop): ?fort_character = | |
var ClosestPlayer : ?fort_character = false | |
var ClosestDistance: float = 1000000000.0 # initialize with a large number | |
for (Player : AllPlayers): | |
EDistance := Distance(Prop.GetTransform().Translation, Player.GetTransform().Translation) | |
if (EDistance < ClosestDistance): | |
set ClosestPlayer = option{Player} | |
set ClosestDistance = EDistance | |
return ClosestPlayer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment