Over the last little while I’ve been trying to put together a series of video tutorials that break down various player character mechanics and do all of that in C++. As a developer by trade I find the usage of blueprints to be quite cumbersome for complicated implementations so I thought “hey let’s start diving into the code and see how bad it really is” turns out … it’s not bad at all !
Each of the tutorials contains a link to my blog post that has a bit more detail as well as supplementary links to resources I reference. In addition to that I will be providing the base project for each tutorial as well as the final product which will set us up for the next tutorial.
Progress so far:
Punch Part 1 - Animations
- Integration of animation montages
- Switching between multiple montage sections
- Randomizing the sequence of punches
- Exposing Blueprint variables via C++
Punch Part 2 - Collisions
- Using box components ( UBoxComponent ) to trigger collisions against our target
- Setting up custom collision profiles for the weapon and target
- Attaching box componetns to Skeletal Mesh Sockets
- Adding in montage notifications using UAnimNotifyState
- Deciding when to turn on / off collisions
Punch Part 3 - Collision Events
- Delegates - delegates allow us to defer logic from specific events to our internal methods based on aligning our method signature with what the delegate expects.
- OnComponentHit - OnComponentHit provides is with information when a block event occurs between two entities in the world.
- FHitResult – the FHitResult struct contains a lot of important information not only about the entity we are colliding with but also all the details about the collision, point of impact, various transform vectors, time, distance, etc etc
- OnComponentBeginOverlap / OnComponentEndOverlap – these are notifications that will fire during the course of our animation playback and trigger specific events on our player character. In our case we are simply going to enable the collisions on our collision boxes.
Punch Part 4 - Sounds
- Intro – Sound considerations and why they are important in game design
- Audio Resources – Finding free sounds using freesound.org
- Tools – Editing those sounds using Audacity
- Import Audio – And finally importing them into Unreal for future use
Punch Part 5 - Playing Sounds
- USoundCue – we are going to attach our WAV file to a sound cue and bring that into our code.
- UAudioComponent – we are then going to tie our sound cue to our audio component to be able to handle playback.
- Playing sounds – we are going trigger the playing of the sound and adjusting it’s pitch to introduce a bit of variance.
Hopefully you guys can make use of this and keep checking back as I will try to keep this post updated as new content comes out.