How to connect an actor with pawn to access the Pawn variables?
Hello guys! I have a problems with variables of a Pawn. I have a Pawn where i change different variables and inputs (like a bool variable of left click mouse). I have a Static Mesh actor. I want to interact with actor using variables from my Pawn. I tried to cast it with my pawn, but when i trying to get access to my variable my project crashes. (Also i know that in blueprint cast node is easy to use. In blueprint we can make a actor reference variable. but in C++ there is nothing like that I think).
Help pls! How can I connect my CursorPawn with this actor??
asked May 10 '17 at 08:45 PM in C++ Programming
GetPlayerController doesn't retrieve a Pawn, it retrieves a Player Controller (PC); is your Pawn a Pawn, or is it a Controller? These are different things. The PC receives input from the player and controls the behavior of a Pawn (which can also be controlled by other Controllers, like an AI Controller).
If you want to retrieve a Pawn, you can get it from the PC:
"(Also i know that in blueprint cast node is easy to use. In blueprint we can make a actor reference variable. but in C++ there is nothing like that I think)."
Everything in BP is possible in C++; Blueprint is written in C++. There are things that can be done in C++ that can't be done in BP, but not the other way around.
answered May 10 '17 at 10:19 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here