text
stringlengths
0
17.2k
Removes this constraint.
Remarks
Unlike other aim-type attachments, the LookAt Constraint does not use up vectors. Instead, you can animate therollaxis to manually control how you want the roll to behave. This can also be useful to eliminate rotation flipping problems, which are common in other aim-type attachments.
Adding Character Animation
This is what you'll see at the end of this section.
The purpose of this section is to show you how to add animations for your First Person Shooter character.
By the end of this section of the tutorial you'll be able to:
During this step, you are going to add some animations into your game.
Before getting started, download and extract the sample animations from the following link:
Right-click in the Content Browser and select New Folder.
Name this new folder Animations and double-click on the created folder to open it.
Right-click in the "Animations" folder and click Import to /Game/Animations/... to begin importing the animations.
The FBX Import Options dialog window appears, select HeroFPP_Skeleton under the Select Skeleton heading, then click Import All to import all of the animations.
Make sure that you select the correct destination Mesh before importing your animations! Failing to do so can cause some issues when you go to map animations later.
You should now have all five animations inside of the Animations folder in the Content Browser.
Click the File in the Main menu panel, select Save All to save your imported mesh.
Navigate to the Animation folder of the Content Browser, right-click in the file window, select the Animation > Animation Blueprint.
Select AnimInstance as the Parent Class and choose HeroFPP_Skeleton as the Target Skeleton.
Name the created animation Blueprint Arms_AnimBP.
Double-click Arms_AnimBP to open it in the Blueprint Editor.
In the My Blueprint panel, click on the Add* button and select Variable**.
Make the variable a Boolean (by defaults, but check the Details panel to be sure) and name it IsRunning.
In the My Blueprint panel, click on the Add button and select Variable.
Make the variable a Boolean and name it IsFalling.
You should now have two animation transition variables that will drive the state machine of the animation.
Keep Arms_AnimBP open when moving on to the next section.
During this step, you are going to edit the Event Graph of the animation to ensure that your animation transition variables are firing properly while the game is running.
Open Arms_AnimBP if you have not already done so.
Open the event graph by double-clicking on EventGraph in the My Blueprint panel.
Right-click in the Graph to bring up the Context Menu, search for and select the Event Blueprint Update Animation node.
The Event Blueprint Update Animation node allows you to update your state variables every time the Animation updates so that they are always in sync with the game state.
Right-click in the Graph to bring up the Context Menu, search for and select the Try Get Pawn Owner node.
Right-click in the Graph to bring up the Context Menu, search for and select the Cast to Character node.
Connect pins of added nodes as following.
Drag off the As Character output pin of the Cast to Character node, search for and select Get Character Movement node (disable Context Sensitivity to locate this node).
Drag off the Character Movement output pin, search for and select Get Movement Mode node (disable Context Sensitivity to locate this node).
Set the dropdown value on the Equal (Enum) node to Falling.
Navigate to the My Blueprint panel, press Alt and drag off IsFalling variable to the Graph to create the Set Is Falling node.
Connect the output execution pin of the Cast to Character node to the input execution pin of the Set Is Falling node, connect the output pin of the Equal (Enum) node to the input Is Falling pin of the Set Is Falling node. Your Blueprint Script should look like the following:
Click image for the full view
Go back to the Cast To Character node and drag off the As Character pin again. This time, search for and select the Get Velocity node.
If the character is not standing still, the length of its velocity vector will be greater than zero. So, drag off the Return Value output pin of the Get Velocity node and select Vector Length node.
Drag off the Return Value float output pin of the Vector Length node, search for and select the Greater node.
Navigate to the My Blueprint panel, press Alt and drag off IsRunning variable to the Graph to create the Set Is Running node.
Connect the output execution pin of the Set Is Falling node to the input execution pin of the Set Is Running node. Connect the output pin of the Greater node to the Is Running pin of the Set Is Running node.
Your Event Graph should now look like the following:
Click Compile and Save buttons.
During this step, you are going to put together a state machine that will take advantage of your newly-made variables.
Navigate to the My Blueprint panel, double-click on AnimGraph to open it.
Right-click the Graph and select State Machines > Add New State Machine... in the Context Menu.