I am not understanding how is it possible to cast a APawn to APlayerController. They both share AActor in their hierarchy. I thought you can only cast to parents or children. And it does not seem that APawn is a child nor a parent of APlayerController. Can someone help me please understand this? This is part of Video “Setting Timers In C++” for shooter C++ game.
I haven’t seen the lecture yet put you are right about casting. A player Controller is actually used to control one Pawn But You can get the Pawn from the Controller that is attached to it…
You are correct. I was taken aback by that statement and was researching this. But today, I finished the video and the teacher did correct it by the end of the video exactly as you are saying. It makes sense. It also is a danger of C++ as it will not complain and just give you a nullptr.