How to Use - Vaei/TurnInPlace GitHub Wiki

Installation

Pre-Compiled Binaries

[!IMPORTANT] This is the easy method for new users but not the recommended method These can be installed either to your project or the engine These are available for Win64 only

[!NOTE] Only the 2 most recent engine versions are included Pre-Compiled binaries may be delayed, for the quickest access to latest release, use git clone

Download the version that corresponds to the engine version you are using.

Download for 5.6 or Download for 5.5

Create a Plugins folder in your project directory, or you can create it in your Engine's Plugins\Marketplace folder. Extract the plugin from the zip file into this folder.

When you load your project, open the Plugins browser, and enable ActorTurnInPlace then restart the editor.

Git Clone

[!IMPORTANT] This is the recommended method The plugin needs to be added to your project, and not the engine

[!WARNING] Do not download as a zip, or you will not receive content

[!CAUTION] Your project will need to be compiled, so it needs to be a code project

Create a Plugins folder in your project directory if it does not already exist.

Use git clone https://github.com/Vaei/TurnInPlace.git and clone it into this Plugins folder.

Right click your .uproject (not the .uplugin) and Generate Visual Studio project files.

If you attempt to open your project it will ask "The following modules are missing or built with a different engine version".

Click "Yes".

If you get the error "ProjectName could not be compiled. Try rebuilding from source manually.", then open your project in your IDE. This typically means double-clicking the .sln if using Visual Studio. Now compile the project from your IDE. If you get a compiler error then you can find out the reason why it could not compile.

Feel free to @vaei on Unreal Source Discord in the #ue5-general channel for help.

Demo Content

[!WARNING] Use git clone instead of downloading as a zip, or you will not receive content

Navigate to the Plugin's Content folder and find the 'Demo' folder.

This is everything you need to try out Actor Turn In Place! Open the ThirdPersonMap.

When you Play In Editor (PIE) you will be playing as the demo character.

On this Character is a property MovementType with 3 options.

Hover over each option to see what it does! By default it uses Orient to Movement which enables UCharacterMovementComponent::bOrientRotationToMovement. You will find that the Movement Component on this Character has a new property called RotateToLastInputVector which is enabled by default.

Without any turn in place solution, this property would allow you to tap a directional key and it would continue rotating towards that direction even when you are no longer pressing any input.

With turn in place, it will turn in place towards that direction. This is how we achieve turn in place with forward movement!

Now try changing MovementType to the other options to experiment. Strafe Desired enables UCharacterMovementComponent::bUseControllerDesiredRotation to have a strafing type movement mode that smoothly interpolates instead of snapping. This is a great movement mode for melee combat while strafing!

And finally, Strafe Direct enables ACharacter::bUseControllerRotationYaw to provide a snapping strafe, well suited to shooters.

[!TIP] You can also walk over the buttons in the demo map to change movement type and get a description of how they function

Integration

Integrating into your own project can be simple, but not always.

Using Existing ATurnInPlaceCharacter

There is a ATurnInPlaceCharacter provided for you that you can reparent your existing character onto. Or you can create a new character derived from this type. Or you can duplicate the included demo character and modify to your liking, but this guide assumes you haven't done this, otherwise you're already setup.

The only other thing you will need is an Animation Blueprint. This doesn't require any C++ and can be completed fully in Blueprint. Make sure to inherit from the ITurnInPlaceAnimInterface and to implement the functions it includes!

Open up the included ABP_Manny_Turn anim blueprint. Simply copy/paste the idle state machine to the appropriate place in your anim graph.

[!CAUTION] If you recreate the turn in place setup in your anim graph manually with any incorrect or mismatched setting can cause serious issues; it is all setup very specifically.

Make sure to go through the Event Graph, AnimGraph, all included Functions including BlueprintThreadSafeUpdateAnimation so that you don't miss anything!

[!TIP] If you have finished setting up your Anim Blueprint but it doesn't turn, you may have forgotten to assign it to your Mesh in the Character Blueprint!

That's all. It's that easy.

Using Custom Character

If you want to use a custom character, without inheriting from the included character, then you must use C++

[!IMPORTANT] We must use PhysicsRotation() and FaceRotation() to TurnInPlace, there is no alternative in a production ready setup It cannot be done in Blueprint, no matter how much we want to

You should be able to reparent both ATurnInPlaceCharacter and UTurnInPlaceMovement if you are willing to modify your existing code-based ACharacter and UCharacterMovementComponent. That is the easiest option.

Otherwise, you will need to copy/paste all of the functionality from both ATurnInPlaceCharacter and UTurnInPlaceMovement into your own. Once that is completed you can read the section above for instructions.