hi, welcome to mix and jam Patel about game development. Experimentation today’s. Project is based on God of War for the PlayStation 4 in the newest game of the series. Kratos has the ability to throw his axe and pull it back.
Making for a mechanic that feels and looks great, my goal for this project is to try and create a similar mechanic using unity. Here are the steps I needed to follow. First, I needed to add animations for all of the character motions.
Then I needed to work on the axe, throw itself in which the axe is the attach from the player and moves forward while rotating the axe collision. That makes it stick to the walls and the axe return where the axe returns to its original position.
With a small curve for this project, I created a third person character control following this video from film storm that teaches how to create that kind of camera control. Using cinema sheen, I also downloaded this model of kratos axe from Dan Harlow in sketchfab and, like the last video I downloaded some animations on Maximo to use on the project.
I started by applying to download animations into the character animator on munities animator. We can organize the character, motions, create transitions between them and set parameters that we can modify by using code.
In my case, I used code to set a walking parameter on whenever the character moves, so the animator could transition to the proper animation. By using the same technique, I was able to set the aiming and throw an animation, [ Music ] for the axe, throw the first thing I did was to add a rigidbody component to the axe to avoid it from being affected by gravity have said.
That is kinematic property on encode. All I needed to do, for the throw to work was to D attach the axe from the player by sending its parent, so no setting the is kinematic property off and adding a force to the rigidbody by throwing the axe and playing the animation.
At the same time, the axe is thrown way before the animation reaches the proper frame. To fix that, I went into the throw animation and created an animation event exactly at the frame. I wanted the throw to happen on the animation event.
I simply called the throw function on my script in the game. The axe rotates while moving forward. So I replicated that by creating a script on the axe that changes its Euler angles. On update on that same script, I added unities on collision enter function to detect whenever the axe collides.
So in that function I just made the axe freeze by setting is kinematic on the rigidbody to true to make the axe return. I use some of the techniques. I found in this video from Omar, in which he also records the same extra use immunity.
This video really helped me a lot so shout out to him in his video. He uses lerp to make the axe return and he also uses a quadratic Bezier curve to make the axe do an arc when returning. I did the same thing and placed an empty object as a child of the character to use it as a middle curve.
Point for when the ax is returning, I added a pull animation for the character. Now, for some polish, I added some basic particle effects to the ax one for the glow of the axe that uses the mesh as a shape for its emission and another, for when the axe is kept with a single admission of a bunch of particles.
I also added a trail renderer to the ax as well to improve an animation a bit more. I did an extra animation State for when the axe is catched to make the motion have more impact to add even more a sense of impact on the catch.
Iannetta scream shakes the camera by using cinema Sheen’s, impact extension and called it in code. I refined the particles and trail by changing their material and just for experimentation. I added some breakable boxes.
I did on the scene, so the axe could break them and then finally, I added some post-processing to add some effects to the camera like bloom depth of field and motion blur after some minor adjustments.
This is how it turned out: [, Music ]. As always, the link for the project’s. Repository is on the description below. If you have anything you would like to see being made on a video. Let me know in the comments if you enjoyed this video don’t forget to like it share with friends and subscribe to the channel.
If you haven’t there’s much more to come, I’ll, see you in the next one: [ Music ], you [, Music, ]