[Newb] Can't get an actor to rotate on keypress without possessing!

I’ve only been working with UE4 for a couple days now. I have hit a snag in my learning process that I’ve been unable to find an answer for.

I created a completely new, blank project with starter content.
I created a few BSP spheres and molded them into a basic shape, and then turned that into a static mesh.

I created a new level, imported that static mesh. Converted it to a blueprint and added some functionality that I thought would allow the player to Rotate that mesh left and right with the arrow keys. But it won’t work.
It does work if I Play the game, click the mesh and Possess it. But I don’t want to have to possess it beforehand.

My blueprint has BeginPlay->Enable Input with a node to Get Player Controller, as recommended in many tutorials.

I also have an Event Tick-> AddActorLocalRotation with a Rotation target based on a variable that is set or cleared when the arrow keys are pressed or released.

The problem is only with the INPUT capturing. My game will not capture the left/right arrow keys until I possess the mesh actor…

This is meant to be a simple top-down view asteroids style learning game where you can rotate the ship in the center of the screen and press a key to fire.

Thanks a ton for any help you can provide!

IMHO you don’t think it the UE4 way.

input from the player controller are only sent to the pawn he “is possessing” actually. Not to all the potential available pawn he can possess. (possessing more mean were the event input from the controller -a mouse, a keyboard- go, it’s how I understand it better; so you need to possess at least something, if you want the player being able to interact in the game!)

Would be a mess if it wasn’t that way. Imagine a soccer game where the player(-controller) can possess any of the eleven teamate of his team. If they where all responding to the same inputs, that mean they would all go right at the same time, etc. (and what about multiplalyer game? to which inputs should respond any unpossessed pawn ?!)

so your player controller should possess your ship, that the simplest way. (you want the controller input be sent to the ship input BP) I don’t understand why you don’t want it to be ? (of course if you prefer you can just interact with that ship from elsewhere, that’s an alternate way of doing the things, but would require more coding)

think about a door in a FPS. you don’t think of having the player possessing the door. (which player would like to play as a door? :D) but you surely want your player being able to interact with that door (open/close). and more specifically you want the player to be abble to interact with a specific door (you don’t want him to press “O” and having all the doors of the level open.)

So what you need is to manage your input from the perspective of the “pawn” the player-controller possess and when it interact with something, just relay that interaction (use custom event or any mean you prefer)

in a pong game, I just put the two paddles meshes in the same pawn for two players playing with the same keyboard (mean I have only 1 player-controller for to real “players”, the player-controller possessing that two meshes pawn). So the input management was easy: S, W inputs to move the left paddle and up, down for the right. That just an example to show you, that a pawn can be anything ! (like an empty pawn, that just have all the logical in it to manage the player input and its interaction in the game)

Thanks for your reply sylvain! You are right, I’m not quite in the UE4 mindset.

I understand now that my player needs to possess the actor/pawn it controls. Makes sense. I have a few more questions though…

  1. How do I make that possession happen from the moment play is pushed?
  2. what is my “player controller” ? Do I need to actually create an object in my level that is defined as the player controller or is that handled automatically and the first (only) player is automatically player controller 0?

I think #1 is all I really need to know… I’m guessing I use the level blueprint for that?

#1 multiple ways as far for what I know:

  • the most versatile ; Possess and UnPossess Blueprint nodes. (and yes, using the level BP beginplay is what I use to set the things at start)
  • for more simple case (you just want to ensure player get control of his single character/pawn), there are in the pawn/character auto-possess options (for AI/player)
  • and you could also use the default pawn + player start assets

select what best suits your needs.

#2 good question :smiley:

If you don’t need to have special thing to do with controller, it works fine. I haven’t really good practice on that point, as I develop just small hobbyist 1 player things. So I usually just keep the default playerController of UE4 and put most of control logic directly in the pawn/character BP (with a pawn for player and different for each AI) for my usage I think its OK. And as far as I’m aware, yep the default player controller for one player game is player 0.

But if we take the case of the soccer team it really make sens to have the intermediate controller level. We don’t want a teammate move only when the player possess it. So there will be constant switch between AIcontrollers and playerController every time the player decide to control an other teammate.