0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【UE5】FirstPersonの「武器を拾う」システムを理解する

Posted at

最初

FPSを制作するに当たって「FirstPerson」テンプレートを使用する
制作するゲームによっては「拾う」というシステムが無く最初から所持している場合がある
そのためテンプレートの「武器を拾う」というシステムがどのように実装されているか見ていく

スクリーンショット 2023-09-20 002541.png

使用バージョン : 5.2

実行順番

結果としては以下の順番

1.「BP_FirstPersonCharacter」が「BP_Pickup_Rifle」に接触

2.接触したオブジェクトが「BP_FirstPersonCharacter」の時「SkeltalMeshComponet」を継承した
武器用のBP「BP_WeponComponent」をAddComponentする

3.「BP_FirstPersonCharacter」にアタッチされた時「BP_WeponComponent」のインスタンスが生成され
BeginPlayが走る

4.「BP_WeponComponent」のBeginPlayで「GetOwner」から追従するMeshを取得して
予め用意してあった「GridPoint」の子供になる

5.「BP_FirstPersonCharacter」の「HasRaife」をONにすることで武器専用のアニメーションを再生する

BP_Pickup_Rifle・・・武器をプレイヤーにアタッチ用のBP(Pickupが「拾う」などの意味)

開始から所持する

最初から武器を所持するには

「BP_FirstPersonCharacter」に「BP_WeponComponent」をアタッチするだけ

「BP_WeponComponent」のBeginPlayが走りアニメーションからすべてやってくれる

スクリーンショット 2023-09-20 003149.png

注意

「BP_FirstPersonCharacter」のBeginPlayで「IMC_Default」をAddMappingしているが
これがいらないので削除しても問題ない
が、何か問題がある場合は自分で解決できる力がある時に限って" 削除しても問題ない "

スクリーンショット 2023-09-20 003511.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?