Mele Attack Range

Hi guys, it’s my 2nd time going through the Combat Creator part ( as still a few bits are unclear, and I want to be sure to understand everything before I move forward).
I have an issue that bothers me a lot. In melee combat, the attack range is set to 2, and when I click on the enemy, sometimes the player stops and keeps the correct range while attacking, however sometimes simply ignoring the range limit and throwing punches nearly through the enemy body (screenshot attached) any ideas on how to take the issue?

Off the top of my head, the first thing I can think of is that the mover isn’t properly stopping the NavmeshAgent…
In Fighter’s update, when the Fighter is within range it should be telling Mover to Stop.
Mover’s stop should be setting agent.isStopped=true; to stop the agent.

Thank you, Brian, for your reply. The fighter script is ok and the navmeshagent stops at the required range and attacks as it should, however during the fight, I can click on the ground and move closer to the enemy, although the player is already in the attack range.
I’m trying to implement some logic to stop the player from moving closer while fighting, perhaps telling navmesagnet not to move forward while in fighting mode. What do you think?

When you click on the ground, it automatically takes the control from the Fighter component and gives it back to the Mover component… The plus side of this is that I can bravely run away when I’m outmatched in a battle… The downside is if you click too close, you’ll pull things out of the Fighter component’s control… Perhaps a check to see if the player is fighting, then ignoring clicks that are less than the Weaponrange. (This would be done in PlayerController)

Thank you once more, unfortunately still no luck. I had to play around with the colliders to make it kind of works, it’s not an ideal solution but will do it for now. I will keep looking for a better solution later on.

Privacy & Terms