Unity rigidbodies and getting them to move properly for our dodge


The problem that I’ve run into this week has been implementing a proper dodge function for our player to use during gameplay. Our player character uses a rigidbody for movement and in general, it works fairly well. The player can walk and jump perfectly fine. The issue I ran into was with our dodge. In most games, a dodge moves the player in the direction they’re facing and temporarily removes their hitbox so they can avoid taking damage. In essence, it’s a simple concept but making it actually work has been quite the issue due to our rigidbody based movement. This seems like a small problem but dodging is the only way we’d have for the player to avoid taking damage from enemies they’re currently engaged in combat with and not having it properly implemented means the difficulty of the game skyrockets and any potential learning curve gets mitigated.

Throughout the week, I’ve attempted numerous different ways of getting the player to move forward a set distance using the rigidbody system, from adjusting their velocity manually, to trying to generate a set position in front of the player for force on the player to be applied towards. I’ve managed to get some success and have the player moving in the direction they’re facing but beyond that, getting the player to move while accounting for level layout to prevent phasing through walls and also having it go over multiple frames and not immediately so it doesn’t seem like an instant teleport (a design direction we’re not trying to go towards), has been the biggest issues.

So far, no solutions have been fully reached, but I still have many ideas that I’m working on implementing and testing. Having the player project a raycast as a forward facing check to help determine how far they can actually move on the frame before the dodge starts is an idea I’ve been testing, but another one is just digging deeper into rigidbody movement systems to see if there’s something I’ve missed while testing other strategies in case the solution has been there the whole time and I’ve simply missed it. I’ll keep working on it until I get it done properly.

Author: Gilbert Pemberton Jr

Posted on 3/22/2024

Get Suits of the Abyss

Leave a comment

Log in with itch.io to leave a comment.