How can I make reference to a pawn without player in a actor component bp?
I made a actor component to handle the movment of a tank pawn, I set the pawn reference called ‘owning pawn’ in the component by casting into the tank bp and ‘get player pawn’ and it works fine.
However when there is no player posessing the tank, the casting fails in the actor component, so how do I reference the tank without a player?
Use a “isValid” node before you do something with the Tank refference. As far refferencing something goes there are multiple ways (see video bellow) but I would suggest sticking with the Get Player Pawn node as you got it right now. If you want to get the Actor that Component is attached to you can do it with “Get Owner” or “Get Parent” (can´t recall UE4 not open atm to say exactly)
Thanks, I still can’t get it to work though with ‘Get owner/parent’. I watched the video, but I’m still not sure how to do this, I’m pretty slow
I’ve set an ‘is valid’ before casting to the tank, and it works fine if I posess the pawn as player 0, but casting fails when I don’t and I understand that the casting will fail, but I don’t understand how to cast to to the tank without a player posessing it.
I’d like to have a number of tanks that uses the actor component for movement,so I’m not sure how to reference each instances of tanks to the actor component.