Hello, I placed 4 tanks on the map and added some code to switch between them whenever a projectile is fired. I can get the PlayerController to possess a new tank, but for some reason the turret mesh only rotates around for the original tank from Player Start (as seen in the gif below).
When I try to log out the tank being controlled,
FString PawnName = UGameplayStatics::GetPlayerController(this, 0)->GetPawn()->GetActorNameOrLabel(); UE_LOG(LogTemp, Display, TEXT("[Testing] Turrent Mesh belongs to: %s %s"), *TurretMesh->GetOwner()->GetActorNameOrLabel(), *PawnName);
LogTemp: Display: [Testing] Turrent Mesh belongs to: BP_PawnTank BP_PawnTank
LogTemp: Display: [Testing] Turrent Mesh belongs to: BP_PawnTank Tank3
The Tank get’s updated for the PlayerController, but the turret mesh always has the original player start tank as the owner.
I added a Timer inside AProjectile::onHit and calls ChangePlayer inside AToonTanksPlayerController.
The Towers all rotate independently. Is there something I am missing in order to rotate the turret mesh individually for each tank?