GetWorldRotation of UStaticMeshComponent in C++

Hello, i’ve spent 3 days to find any way to do this in C++ and stuck on this part. Currently, i lerp whole player, but i need to lerp only PlayerMesh, it wasn’t a big deal so i ignored it after few hours of searching. Now i NEED to find PlayerMesh location to spawn projectiles, but currently i stuck at dead end:

UStaticMeshComponent* pMesh;

pMesh = Cast<UStaticMeshComponent>(GetOwner()->GetComponentByClass(UMeshComponent::StaticClass()));

So, now i think that i’m doing it wrong and more important → i can’t get it Rotation and Location.
Thank you!

You are looking for GetComponentLocation() and GetComponentRotation().

Yep, it’s obvious. I need to know how i can get GetComponent…() for PlayerMesh UStaticMeshComponent and proper way to get this PlayerMesh in C++ if i did it wrong.

  1. To make it work i used UMeshComponent instead of UStaticMeshComponent.
  2. Don’t GetOwner() when call GetComponentByClass() or it would crash UE4
    It’s all working now thanks to that simple things