ミニボードに自分のボード上で攻撃されたマスを示すインジケーターを表示するには、ボードのタイル座標をミニボード上のワールド位置に変換する必要があります。
ミニボードでタイル座標をワールドトランスフォームに変換
以下の手順で、タイル座標をミニボードのワールド位置に変換します。
ミニボードのスケール係数を取得します。
スケール係数を使用してタイル座標を
vector3に変換します。ミニボードの回転に合わせてマーカーを回転させます。
return で作成したトランスフォームを返します。
ゲーム ボードの寸法を取得するために GetDimensions という名前の関数を作成します。
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 }
miniboard<public> := class(creative_device):
...
ミニボード マーカーの設置
ミニボードにミニボード マーカーを配置するには、次のことに注意する必要があります。
マーカーが配置されるボード タイルの座標
ヒットマーカーとミスマーカーのどちらか
DataTypes モジュールでマーカー型を表すための新しい列挙型を作成します。
using{/Verse.org/Simulation}
using{/Verse.org/Random}
using{/UnrealEngine.com/Temporary/SpatialMath}
DataTypes<public> := module:
...
marker_type<public> := enum<open>:
Hit
SetMarker 関数を定義し、ミニボード クラスのミニボードにマーカーを配置します。
この関数は、次のステップを実行します。
有効なミニボードがあることを確認します。
使用するマーカー メッシュのタイプ (ヒットまたはミス) を決定します。
入力タイル座標のミニボードのトランスフォームを取得します。
マーカーをスポーンします。
マーカー配列にマーカーを追加します。
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):
...
概要
要約すると、このページでは、次の手順を実行しました。
ミニボードにマーカーを配置します。
ミニボード空間、ボード空間、ワールド空間の間で変換します。
ファイル
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