To move an actor with enhanced input in Unreal Engine, you'll need to use the Input System and set up an Input Action. Here's a step-by-step guide:
Prerequisites:
Make sure you have Unreal Engine 4.21 or later installed.
Create a new project or open an existing one.
Create an actor (e.g., a character or a pawn) that you want to move.
Step 1: Create an Input Action
In the Unreal Engine Content Browser, right-click and select Input Action.
Name your Input Action (e.g., "MoveActor").
In the Input Action settings, set the Action Type to Value.
Set the Input to Gamepad or Keyboard (or both, depending on your needs).
For Gamepad, select the Left Stick or Right Stick (depending on your desired movement axis).
For Keyboard, select the W, A, S, and D keys (or Arrow Keys).
Step 2: Create an Input Component
In the Unreal Engine Content Browser, right-click and select Input Component.
Name your Input Component (e.g., "ActorInputComponent").
In the Input Component settings, set the Input Action to the one you created in Step 1 (e.g., "MoveActor").
Step 3: Add the Input Component to your Actor
Select your actor in the Unreal Engine World Outliner.
In the Details panel, click the + button next to Components.
Search for and add the Input Component you created in Step 2 (e.g., "ActorInputComponent").
Step 4: Set up the Movement Logic
In the Unreal Engine Event Graph, create a new Event Graph for your actor.
Add a Get Input Action Value node and set the Input Action to the one you created in Step 1 (e.g., "MoveActor").
Add a Make Vector node to create a movement vector based on the input value.
Add a Add Movement Input node to apply the movement vector to your actor.
Here's a simple example of what the Event Graph might look like:
blueprint
+---------------+
| Get Input |
| Action Value |
+---------------+
|
|
v
+---------------+
| Make Vector |
| (X, Y, Z) |
+---------------+
|
|
v
+---------------+
| Add Movement |
| Input |
+---------------+
Step 5: Compile and Save
Compile your actor's blueprint.
Save your project.
Now, when you play your game, you should be able to move your actor using the input method you set up (e.g., gamepad or keyboard).
Note: This is a basic example, and you may need to adjust the movement logic and input settings to fit your specific game's requirements. Additionally, you can use more advanced features like input curves, dead zones, and sensitivity settings to fine-tune the movement feel.