(Short video) I'm having fun with the Unity RPG Course!

As some might have noticed with my few post around, I’m having fun working on my Metroidvania RPG kind of game while following the making a RPG course.

I shared a few screenshots, but I don’t think they actually represent how great I feel about what I have accomplished until now so I recorded a short video of what has been implemented.

Here’s a unlisted link to the video on Youtube:

(unlisted means that it doesn’t appear in public search/view, but anyone with the link can watch it. It’s too early to share it openly on a channel.)

5 Likes

A small addition (not shown in the video) that I had to implement is the sidewalk animations.

While the NavMeshAgent runs the player toward its destination in a relatively straight way 99% of the time, the remaining 1% feel unnatural if you only update when the player is moving forward (through the NavMeshAgent velocity)

In my short video, this is noticeable at at 0:15, as the character moves to face its target (the wooden crate). There’s quite a bit of sliding involved visually. This is because of a tiny bit of conflict between the NavMeshAgent and the forced rotation toward the target. In short, when I rotate the player toward the target, the NavMeshAgent is noticed of the change and depending on the relation between the target and player positions, the NavMeshAgent automatically reposition the player with the next rotation in mind.

One possible fix would have been to disable the NavMeshAgent movement while close to the target, but this comes with the risk of having the NavMeshAgent movement disabled at the wrong time. It’s also slightly inconsistent as to when/how the player is considered close enough to the target in certain scenario depending on the target’s size, form and collision mesh. In the shown example above, the reason is because of the size of the player’s NavMeshAgent and the corner of the box being just a tiny bit too much onto the limited NavMesh data.

So, to fix things up, I added a left/right walk animation to the blend trees of the movements and I’m updating a new float value in the Animator called “Sideway Speed” based on the NavMeshAgent’s velocity on x. (Forward is Z and Sideway is X). This not only fixed the bit of sliding around the target, while within an action’s range, but also made the 180 turns (as shown around 0:05, 0:09, 0:18 and 0:23) quite a lot better. (When the player change direction between left and right movements, he/she slow down and naturally turn around with the legs first, followed by the torso in a fast, but smooth manner that takes about 1 sec.)

So, now, whenever the NavMeshAgent requires lateral movement (side ways) as I reorient the player to face the target, the animation allows the player to move side way naturally. It’s nothing major, but just a small detail that really makes things visually better. :smiley:

Privacy & Terms