I’m trying to create an ability to allow my player character to teleport to the location of a projectile they shoot out. In theory, when I rightclick on the mouse, the player script will call a function that is part of the projectile.
This is what I have for the actual teleportation:
void BallTele(class AActor* playerActor)
{
ProtoCharacter* player = Cast(playerActor);
if (playerActor != nullptr)
{
player->SetActorRotation(GetActorRotation()); // Line 7
player->GetController()->SetControlRotation(player->GetActorRotation());
player->SetActorLocation(GetActorLocation()); //Line 9
}
}
I feel really dumb, but I can’t seem to figure out how to get the projectile to obtain its own transform when I call the function.
Lines 7 and 9 are the ones I’m struggling with. When I try to compile I am told that there is no identifier for GetActorLocation and Rotation. I’ve tried storing a pointer to the class in a variable in the header file and getting actor transform from that. I’ve tried using the “this” keyword but that doesn’t seem to be valid. I’ve tried getting the transform from the RootComponent.
I’ve also done a lot of searching on Google and the API but have had no luck so far.
Any and all help would be greatly appreciated.