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?

UE5勉強日記 C++で作ったActorのlocationとrotation表示されない

Posted at

C++で下記のようにActorを定義して、blueprintを生成したが、

private:
	UPROPERTY(EditDefaultsOnly)
	UStaticMeshComponent* ActorMesh;
    UPROPERTY(EditDefaultsOnly)
    UCapsuleComponent* CapsuleCollision;

RootComponent ActorMeshのlocationとrotation表示されない問題が発生(下記図)
image.png
※CapsuleCollisionのlocationとrotation表示されます。

publicを変更したり、UPROPERTYを変更したりいろいろ試したが、表示されないままでした。

解決策

private:
	UPROPERTY(EditDefaultsOnly)//追加
	UStaticMeshComponent* RootMesh;//追加
	UPROPERTY(EditDefaultsOnly)
	UStaticMeshComponent* ActorMesh;
    UPROPERTY(EditDefaultsOnly)
    UCapsuleComponent* CapsuleCollision;

RootMeshを追加,RootComponentをRootMeshに設定、
そして
ActorMesh->SetupAttachment(RootComponent);
※RootComponentはRootMeshではなくほかのもので置き換えでもいいと思います

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?