Let’s Get Rolling

Jordan Evans
Sep 9 · 3 min read

While I continue to expand on a course, I’ll take a quick moment to build a roll system to work with. This will allow me to look at creating paths that are too large for the player to walk through.
To start, we will have to go back to Mixamo and find a animation to work with. From there, we will want to repeat the same processes we have done before to properly utilize it within our game. Once we have it all set up, we will need to work out some code that will allow us to roll our character. As a test to be sure it works, we will use a square as our obstacle and allow our character to roll under it. We will then want to create a roll under tag so that our character is able to roll under specific obstacles:

As you can see we can make our character roll under this obstacle, but as to how, we will have to look over the coding for that process:

We will first need a couple of variables to work with:

We will then want to create our input action that works when we are not jumping and will trigger the animation along with setting our rolling to true:

Here, we are going to have our character be able to detect if the object we are trying to roll under has the proper tag. If it does, then we are able to roll underneath our object. As for the RollEnds portion, this is for our animation ending routine:

What this does is allows the animation to play through and then exit into the animation sequence that we desire. Now that this is all finished we can test it within our game:

Now the slight issue we have here is that our character pushes the object away when he stops underneath the object. To fix this issue, we need to be sure that on the rigidbody of the obstacle, we check of Is Kinematic:

Now that our player won’t push away the obstacles, we can continue on with our project and the new method of movement needed to get through the course.

Nerd For Tech

From Confusion to Clarification

Nerd For Tech

NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit https://www.nerdfortech.org/.

Jordan Evans

Written by

Nerd For Tech

NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit https://www.nerdfortech.org/.