Verse Library verse

07 Files

Converts between tile coordinates and world vectors while validating positions against board bounds.

extracted-snippets/documentation/en-us/fortnite/3-set-and-remove-pawns/07-files.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/3-set-and-remove-pawns
# Local doc:  epic-docs/documentation/en-us/fortnite/3-set-and-remove-pawns.md
# Section:    Files
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Verse.org/Assets }
using { DataTypes }
using { UtilityFunctions }
board<public> := class(creative_device):
@editable
Bounds<public>:board_bounds = board_bounds{}
@editable
TileSize<public>:vector2 = vector2{}
@editable
PawnStaticMesh:mesh = Meshes.SM_Pawn
var<private> Pawns:[]creative_prop = array{}
<# Tile <--> World #>
# tile_coordinate within board_bounds
IsTileCoordinateOnBoard<public>(TileCoordinate:tile_coordinate)<decides><transacts>:void =
Bounds.LeftBounds.Low <= TileCoordinate.Left <= Bounds.LeftBounds.High
Bounds.ForwardBounds.Low <= TileCoordinate.Forward <= Bounds.ForwardBounds.High
# tile_coordinate -> vector3
ToVector3<public>(TileLocation:tile_coordinate)<decides><transacts>:vector3 =
IsTileCoordinateOnBoard[TileLocation]
BoardTransform:transform = GetTransform()
CenterOfBoard:vector3 = BoardTransform.Translation
TileOffsetFromCenter:vector3 = vector3:
X := (TileLocation.Forward * TileSize.X)

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