見出し画像

UEFN:Verseの学習記録2023/08/09


学習方針

Epic公式ドキュメント
「Verse を使用したプログラミングを学ぶ」からVerseを学ぶ
は厳しすぎたので、下記は参考程度にとどめます。
今後は気になった機能を実装しながらリファレンスを読み進める感じで進めます!!

Verse 言語のクイック リファレンス

Verse コードのスタイル ガイド

その他:Verse関連(一番下)
Verse 言語のリファレンス
Verse API Reference
Verse 用語集


学習成果

オブジェクトを動かす

参考①:MoveTo

参考2②:現在地取得


ソース(青の円柱を動かしたソース)

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }

# 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
zip_move2 := class(creative_device):

    @editable
    crash_BP : creative_prop = creative_prop{}


    # Runs when the device is started in a running game
    OnBegin<override>()<suspends>:void=
        spawn:
            Rotation_zip()

    Rotation_zip()<suspends>:void=
            var YawAngle : float = 0.0
            var PitchAngle : float = 0.0
            
            ## 現在位置の取得
            CurrentLocation := crash_BP.GetTransform().Translation
            var Position : vector3 = CurrentLocation + vector3{X:=0.0, Y:=0.0, Z:= 900.0}

            loop:

                targetRotation := MakeRotationFromYawPitchRollDegrees(YawAngle, PitchAngle, 0.0)
                # crash_BP.MoveTo(vector3{X:=2208.0, Y:=-1434.9, Z:=900.00}, targetRotation, 1.0)
                crash_BP.MoveTo(Position, targetRotation, 1.0)

                set YawAngle = YawAngle + 20.0
                set PitchAngle = PitchAngle + 30.0


資産:GitHub

zip_move2.verse



この記事が気に入ったらサポートをしてみませんか?