FPS add animations

Hello

I’m trying to setup the animations on a FPS pawn…

I got the hands model setup based on the shooter sample. So now I need to add my walk, run aim and reload animations…

But I’m confused about how I setup the animation blueprint on a FPS pawn…

I’ve made these animations and exported to UE4, that I now would like to add to my character:

Pistol_AltFire
Pistol_Equip
Pistol_Fire
Pistol_FireAim
Pistol_Idle
Pistol_IdleAim
Pistol_MeleeAttack
Pistol_Reload
Pistol_Run
Pistol_Walk
Pistol_WalkAim

I want make animation for each weapon type(Pistol, rifle shootgun etc.)

But where can I find some help to setup this?

I’ve looked at third person blueprint tutorial on youtube, but it got me even more confused about how I do this on a First person pawn??

Anyone know where I can find a tutorial or something for a FPS game, or can provide a sample of how to setup this?

As far as I’m aware, all the third person tutorials can be applied to a first person game as well. The only difference might be where you place the camera. Maybe also attach the camera “boom” (forget what it’s actually called" to the head rather than the torso so that your mesh won’t accidentally cover the camera. Might get a little dizzying though because that would make the camera move with all head movements… hmm… Ok, maybe find a way to hide the head so it doesnt mush through the camera.

I know how to do the basics…

I’ve got a blendspace working with my Idle, walk and run animations.

Then I tried to add a Pistol Reload and Melee attack animation:

The problem is I want to change the animations depending on the weapon type equipped… So a Shootgun don’t reload and melee attacks with the same animation as the pistol etc… But I Don’t know how I can make this?

Also I need to find out how I make my Aim animation work… I want something like a Blendspace if possible to blend between the idle animation and a Aim pose when pressing the right mouse button… The script in the video above, is just making my gun jiggle when i press right mouse button…

Have been searching the forums, but can’t find much useful information about this…

But I did find this topic, which shows the use of Enum and Struct:

So I created a Enum and struct like this:

5267708971d4133d1872fcf2fcceb77879b4ff33.jpeg

But I don’t know how I setup my Anim blueprint using Enum and Structs like in the screenshot above:

This struct going inside of the state machine in the animgraph.

I’ve moved the structure inside the state machine and added it to my blendspace…

e903286d8db5230dc5586585dedb0bd8f1378343.jpeg

But I still don’t know how to continue from here, any advice is appreciated…

ok, umm, it is not easy answer in a forum post, IMO, you need first learn about state machines and animgraph and the answer at your problem come alone.

https://docs.unrealengine.com/latest/INT/Engine/Animation/StateMachines/index.html

https://docs.unrealengine.com/latest/INT/Engine/Animation/StateMachines/CreatingStateMachines/index.html

https://www.youtube.com/watch?v=F1Apwm4F15I

about aim:
Set the aim in the character blueprint
b62bbddb29b92fe59f81f19cd203e43f7ba12cbc.jpeg

Cast the player to set a variable in animblueprint
f4b2ff78210178cf0a85d4b5881d8da9483ed1d4.jpeg

Set a conexion between animations
2e3e8fee30a6f25eeba1ba7a5ea4049e113ccaaa.jpeg

Use the casting variable to check the transition
daf7ce3527242051367b090fc62fe96f639deabd.jpeg

An another to exit and back to idle/walk
dc1a3d371672527493dda16cdae5a6796f67b6df.jpeg

Thanks for the reply…

I know how to do the basic setup of the state machine(what shown in the youtube tutorials), but the problem is now my pawn set using the pistol animations as default, but when I pickup/Switch to a shootgun I want to change all animation to my shootgun animations(reload,walk run etc.)…

But I have no idea how I’m going to switch the animations, depending on the equipped weapon… Need some advice on how to make this…

I’ve now moved the aim function into state machine and experimented a little with adding the shooting animations… Now it only works in Aim mode and it keeps looping…

Here is a video showing my blueprint:
https://youtube.com/watch?v=Rrndex9Z750

Here is a demonstration of my pawn. Still working on smoothing the idle to aim, when I move the skeleton mesh to center of the screen…
https://www.youtube.com/watch?v=e-x-u3d-dBA

-You need a struct for each weapon.

-Put in the player a “Weapon type” variable. When the player change weapons change this variable when the choose structure.

-Get a duplicated “Weapon type” in animblueprint.

-Both variables are type “struct”

-When the player change of weapon you need set(change) the variable “Weapon type” in your animblueprint casting the player choice (similar to my second picture. I Get the “player weapon” type and Set to the “Weapon type local” )

soo when “Weapon type” is shootgun it use the structure of Shootgun.

is It make sense?

Yes it made much more sense…

I was confused about how to communicate with the struct, until I found “set members” then I started to understand how it works…

I’ve not added weapons yet, so I’m switching using events, and it still need some work:
https://youtube.com/watch?v=np29NKSo8kc
Any ideas to how I can improve it is highly appreciated…

a liitle clue…

63ce46a63eb17c6018fa9626f876e8a38078baf6.jpeg

Arrays are the better friends. InventoryWeapons is a array of struct weapons that hold the weapons. You can set directly all struct to “Weapon type”

Yes I will definitely try to use Arrays, when I learn some more about using it…

I’ve started on adding weapons and got a working system for switching weapon and animations using structures…

But I have some problems with spawning muzzle flash and bullet trail, which I’ve made a topic about here: