VerseIsland
FeedLearnLeaderboardGuidesReferenceExploreSearchDocsVerse Library
Sign in
Feed Learn 📖 Codex Leaderboard Guides Reference Explore Search Docs Verse Library
Browse Community Snippets›Verse Language·Up to Community Snippets · Verse Language·66 of 114 in Verse Language

MapRangeUnclamped And MapRangeClamped

113,308 Views

Report

  • # Map range unclamped
    # - Value: a floating point number
    # - From: a tuple of two floating point numbers representing the original range
    # - To: a tuple of two floating point numbers representing the target range
    MapRangeUnclamped(Value: float, From: tuple(float,float), To: tuple(float,float)): float =
    
        # If the two values in the 'From' range are the same, there's no range to map from.
        if(From(0) = From(1)). Err("Error mapping range - From range cannot be equal.")
    
        # Calculate the ratio of the difference between the 'Value' and the first value of the 'From' range,
        # to the difference between the second and the first value of the 'From' range.
        Ratio := (Value - From(0)) / (From(1) - From(0))
    
        # Scale the ratio by the difference between the 'To' range values,
        # and add the first value of the 'To' range to get the final mapped value.
        return Ratio * (To(1) - To(0)) + To(0)

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 Discord — free for members Read the original at Epic Games documentation

Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.

Guided course

Add this to your free study plan — we’ll suggest related material and stitch it into one compile-checked lesson.

Keep exploring
More in Verse Language · 66 of 114
Prev
fortnite wrapping subscribe to pass additional data to listeners
Next
fortnite organizing code into modules

Source

Epic Games documentation

View original

Last updated 2026-07-26T12:55:47.499718+00:00

VerseIsland· an archipelago of Verse & UEFN knowledge
🗺️ Island atlasLearnGuidesHistoryAbout & PressSources & LicensingPrivacy PolicyTermsStatus

Not affiliated with Epic Games. Fortnite, UEFN, Unreal Engine, and Verse are trademarks of Epic Games, Inc. Content is attributed to its source — see Sources & Licensing.

🦜

Scout · your island guide

The Isle of Verse