After I implemented a decent camera last time, I decided to implement a mandatory feature each serious game must have : camera shake! As you will notice, it is damn easy to add this feature in UE4, and it adds a lot to the game.
For now, I only added the camera shake when players grab the rim after they do a big dunk. This makes this post the perfect place to showcase a few different dunks I've created over the last few weeks.
Lets go straight to the point: a video of a dunk, and what the camera shake looks like:
Playing a camera shake in C++ is easy:
- In the editor, create a new blueprint from the UCameraShake class
- Customize the values as needed
- Call the static function APlayerCameraManager::PlayWorldCameraShake
That's it. Pretty simple no?
For your information, here are the values I currently use:
To end this short post, here are 3 other dunks I have integrated in the game. I first created different kinds of dunks to setup some various properties like :
- animation initiation: layup? two foot impulse?
- socket to attach the ball to : left / right hand? specific ball socket?
- position of the player at the end of the dunk: facing the rim? reverse?
- which hands are used to hang to the hoop : two-hands? one hand? invert hands (for reverse dunks)?
Sit on the ball
There is a problem with this dunk I still need to solve. When the player throws the ball between his legs before he hangs to the rim, he doesn't catch the ball above his head like he should. I suspect a blend issue with the next played montage.
This dunk is one example where the ball is attached to one hand, while the hanging animation uses both hands.
I have lots of different ideas for new dunks to implement, I'll show you whenever I'll create new animations for them, and integrate them in the game.