How to control actor position using keypresses?

I have created a new level, and made it the default level. I also changed the pawn type to Pawn (from BP_ThirdPersonCharacter). I don’t really need a pawn.

Here are the screenshots:

Now, I have dragged a model (Baffin) onto the scene, and positioned it at the starting point of the flame. I am a total n00b. My question is, how to I capture key presses, so that I can move the Baffin around. I would also like to set the Niagara simulation’s local pivot too, at the same time. I know it is likely simple, but I have not found a tutorial yet that shows how to do such a thing.

Thanks for your time and effort.

You definitely do want a pawn. A character to be more specific. What you’re describing are the jobs that the pawn handles.

A character is what should be holding your model and niagara system.

This is where to create a new one:

Since you have the ThirdPersonCharacter template in the project, you can just navigate to BP_ThirdPersonCharacter and copy the code. It may look something like this depending on your input system and version:

1 Like

Thank you for your extensive answer.

OK, I gave it a try. I believe that I do not need a Character. I don’t need any walk animation, because my main mesh is a space ship (a static mesh). It won’t let me pick a static mesh here, only a skeletal mesh.

I added a Pawn, but there are no mesh options like there is for Character.

All I really need is a Baffin and a NS_Combined somewhere on the screen, controlled by the arrow keys. Unlocking this in UE 5.1 + Blueprints will lead to an epiphany on my part, I believe. I know it can be done, I just don’t know how yet.

Thanks for your patience. :slight_smile:

Check this link:

  1. Connect this node to your Input Axis event in your blueprint or simply bind to a keyboard key event;
  2. Please use Blueprint instead of a static mesh in your scenes;

by the way, you can refer to the blueprint in default project and understand how blueprint is working on an Actor and drive it by press the key binded in project settings.

1 Like

I agree; you need a Pawn subclass, but you don’t need a Character.
You should make your controlled actor be a subclass of Pawn, and then possess it from the PlayerController.
Then you can set up input events in the Input section of the Project preferences dialog.
Then you can go into your Player Controller and add event handlers for those input events – right-click in the event graph, type the name of your input event/axis (example “right”) and select the particular event you want to handle.
Then, inside the event handler, do whatever you need to do – typically, update some property on the pawn so it knows how it needs to move.

Then, inside Tick in the pawn, update the pawn as appropriate. (Unless you use physics and torques/forces instead; in that case, you may not need to implement Tick because the physics component does that for you.)

In general, in Unreal Engine, it’s almost always better to use an Input Event, that’s bound to a key, rather than trying to read the keyboard directly from actors. Input Events support everything you need like not doing things while focus is on a pause menu, allowing for international keyboards, binding movement to multiple options (gamepad, mouse, swipe, …) and so on.

1 Like

Thank you for your reply. This Add World Offset seems to be exactly what I need, so thanks for the insight.

You’re welcome.

1 Like

Well, I hate to sound skeletal-phobic, and so I’ll play the role of devil’s advocate here: say the goal is to have my Baffin transform like in Robotech or Transformers… I’d likely need a skeletal mesh, right? Not necessarily bipedal, mind you.

Thank you for clarifying the steps. I’ll work on this tonight.

You can add a skeletal mesh component to a regular pawn, without using Character. It can still use animation blueprints and so on.
Character is more about the specific movement impemented for typical player characters. The CharacterMovementComponent, specifically, does a bunch of things to “feel good” for that kind of gameplay.
If you want to implement physics other than the Character physics, you almost certainly want to use Pawn rather than Character.

1 Like

Well, thanks again! I’m in a fog, and I can hear you but I can’t see you yet. The fog is especially dense — the learning curve for a lot of things in UE5 + Blueprints is more like a quantum leap. One leap at a time though, I will master UE5 + Blueprints. Thanks for the help.