To mark up the miniboard with indicators showing which tiles on your board have been attacked, you need to convert a board tile coordinate to a world location on the miniboard.
Convert Tile Coordinate to World Transform on Miniboard
The procedure to convert a tile coordinate to a world location on the miniboard is:
Obtain the scale factor of the miniboard.
Convert the tile coordinate to
vector3by using the scale factor.Rotate the marker to match the rotation of the miniboard.
Return the constructed transform.
Create a function named GetDimensions to obtain the dimensions of the game board:
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):
Next, you will need a procedure to convert a tile coordinate to a transform located on the miniboard:
Ensure that there is a valid miniboard.
Obtain the dimensions of the game board.
Obtain the relative scale of a tile in miniboard space from the dimensions of the miniboard and the larger board dimensions.
Obtain the camera transform.
Define the rotation required to rotate the miniboard mesh axis forward.
Construct the rotated offset world location with respect to the center of the miniboard.
Obtain the miniboard transform.
Add the miniboard offset from center to the location of the miniboard to obtain the miniboard transform for the tile coordinate.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Verse.org/Assets }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { DataTypes }
miniboard<public> := class(creative_device):
...
Place a Miniboard Marker
To place a miniboard marker on the miniboard, you need to know:
The board tile coordinate where the marker is will be located.
Whether it should be a hit marker or a miss marker.
Construct a new enum to represent the marker type in the DataTypes module:
using{/Verse.org/Simulation}
using{/Verse.org/Random}
using{/UnrealEngine.com/Temporary/SpatialMath}
DataTypes<public> := module:
...
marker_type<public> := enum<open>:
Hit
Define a function SetMarker to place a marker on the miniboard in the miniboard class.
This function performs the following steps:
Ensure there is a valid miniboard.
Determine what type of marker mesh to use: hit or miss.
Obtain the miniboard transform of the input tile coordinate.
Spawn the marker.
Add the marker to the markers array.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Verse.org/Assets }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { DataTypes }
miniboard<public> := class(creative_device):
...
Summary
To summarize, this page has taken you through the following steps:
Place a marker on the miniboard.
Convert between miniboard space, board space, and world space.
Files
using { /Verse.org/Simulation }
using { /Verse.org/Random }
DataTypes<public> := module:
tile_coordinate<public> := class<concrete>:
Left<public>:int = 0
Forward<public>:int = 0
bounds<public> := class<concrete>:
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):
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Verse.org/Assets }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { DataTypes }
# See https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-device-in-verse for how to create a verse device.
# A Verse-authored creative device that can be placed in a level