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.

Unreal Engine4 UCharacterMovementComponentについて

Posted at

UCharacterMovementComponentとは

https://www.main-function.com/entry/2017/11/25/225805
こちらの記事にて詳しく解説されています。

つまり、キャラクターを動かしたり、その時のパラメータを取得することができるよ~というコンポーネントであるのですが、まだ全然理解はできていない。

現在はこのように使用しており、書かれたものを見せられると「はいはい、なるほどね」とわかるが、実際に「この処理書いてね」と言われて書けるかといわれると怪しい。

  • TryGetPawnOwnerでPawnを取得
  • Pawnを取得した変数->GetCharacterMovementコンポーネント->関数であったり、プロパティ
    で覚えておけばいいのかな
if (ShooterCharacter == nullptr)
	{
		ShooterCharacter = Cast<AShooterCharacter>(TryGetPawnOwner());
	}
	if (ShooterCharacter)
	{
		//キャラクターが空中にいるかどうか
		bIsInAir = ShooterCharacter->GetCharacterMovement()->IsFalling();

		//キャラクターが走っているか
		if (ShooterCharacter->GetCharacterMovement()->GetCurrentAcceleration().Size() > 0.f)
		{
			bIsAccelerating = true;
		}
		else
		{
			bIsAccelerating = false;
		}
	}

おわりに

BPでUnreal Engine開発を始めて調子に乗ってC++で始めましたが、痛い目にあってます...
頑張っていきます....

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?