StartSpectatingOnly question

What does this do, as compared to GetPawn()->DetachFromControllerPendingDestroy();?

My Take Aiming Component is still aiming my barrel after I’ve been de-attached, and I get an ensure error.

Separate question: Why do we detachfromcontrollerpending destroy? What’s it used for exactly?

Thanks!

I’m not sure I get the context here.

Let me explain in a bit more detail! I will try to ask better questions in more detail in the future!

At the end of the Battletanks course in the TankPlayerController and TankAIController on the death event we call 2 different functions.

For the AI we call DetachFromControllerPendingDestroy()

And for the player we call

void ATankPlayerController::OnPossessedTankDeath()
{
	StartSpectatingOnly();
}

Once this is called, I do see that i can no longer control the tank movement, (instead a spectator pawn), BUT I’m still controlling the aiming (the turret and barrel move toward the cross-hair). Wherever my spectator aims, the tank aims as well.

I was under the impression from the video that StartSpectatingOnly was a similar call to DetachFromControllerPendingDestroy(), just for the player, but I see that it isn’t quite the same.

How do we delink from the tank completely similar to the AI Tank call, getting ready to possess another tank?
Or is this beyond the scope of the BattleTanks course?

Perhaps the problem is that the way we intercept the aim callbacks is not being passed through the player controller. StartSpectatingOnly should stop that coming through to the pawn so I would check that.

Privacy & Terms