Getting transform variable of own class

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.

Problem is here:

void BallTele(class AActor* playerActor) { ProtoCharacter* player = Cast(playerActor);

Functions in class (since C++ let you make function outside class as you normally do in C, but not in UE4) is automatically namespaced, technically class is also namespace and everything in part of that namespace (this include variables).

So when you put name something from class on global scope you need to also put namespace of class, so you should do this (note that i don’t know you class name ;p)

void AYourParticuleClass::BallTele(class AActor* playerActor)

Now just to note, you don’t put namespace inside the function as inside function scope that is part of namespace compiler automatically assumes you be using functions from that class so it check it’s namespace, it same as you would do using AYourParticuleClass; . Fact that you didn’t state namespace is reason why you got those errors, not to mention without it compiler thinks you making global function not defining function from the class

Oh wow I’m dumb. I already knew about namespaces! I really appreciate it. I need to get a rubber duck or something to talk myself through my code. This was a really silly oversight. Thank you so much for your help and time!