Twin Stick - DrowningDragons/MoveIt-Wiki GitHub Wiki
Getting Started
In the MoveIt Content Templates folder you will find an animation blueprint and a character blueprint (BP_MoveIt_Character_TwinStick
). The animation blueprint is only an example and will be out-dated, you should use AB_MoveIt and modify it similarly.
If the relevant blueprint or folders are missing please ensure you are on MoveIt version 2.312 or higher.
This blueprint provides instructions in the comments. To succeed with this template, you should read these carefully.
You should duplicate this blueprint into your own project as a starting point if it's a new project. For existing projects that want to utilize the functionality, inherit from the custom character class MICharacter_TwinStick
but check the existing blueprint to see how to utilize it properly.
This template has the minimum required functionality and you will likely want to expand on it.
Override Functions
Can override in either C++ or BP. C++ recommended for performance because these are called on input tick.
Update Control Rotation
This simply calls PlayerController->SetControlRotation(NewRotation);
and it should be extended to add interpolation and so forth.
You may notice the character snaps with a sudden change in direction. The reason interpolation isn't simply provided is to not assume how you'd want to interpolate, such as when attacking, or moving, or idle, etc.
Get Mouse Facing Rotation
This is what ultimately determines where the character looks when using the mouse. Some games may want a more intricate manner of determining the rotation such as using a line trace - currently the character just looks where the cursor is on the screen
Get Gamepad Facing Rotation
As above but for gamepad
Call Functions
Receive Mouse Turn Input
Call this from your input event for rotating the character via mouse
Receive Gamepad Turn Input
Call this from your input event for rotating the character via gamepad
Helper Functions
Set Custom Game Mode Input
SetInputModeGameOnly
can have an issue where it doesn't properly register click events. This node is equivalent however it uses the setting which is unavailable to Blueprint GIM.SetConsumeCaptureMouseDown(false);
This still doesn't fix the capture issues with mouse axis input events when PlayerController->bShowMouseCursor == true
which is why you'll need to click and drag to turn when using a mouse.
Events
On Receive Player Controller
Typically you should have a custom player controller that has your mouse settings, this exists primarily for the demo but can be utilized however you wish. Runs on both server and local client.
On Receive Controller
As above but for non-player controlled characters