AgentNolan gets too close to player during melee in FirstPersonMeleeScene

corb555

New member
In the FirstPersonMeleeScene, everything is working as expected. However, once AgentNolan is in a Melee attack, he gets right next to the character. I'd like to keep a little more space between Nolan and AgentNolan during the melee fight. In the Behavior tree there are variables for AttackDistance and NearDistance, but those don't help since this is happening within the attack. I had seen an item in the Forum for creating a separation distance between them, but I can't find that now. Any suggestions for keeping them a little bit apart during attack?
 

corb555

New member
Thanks for your reply!

These are the main active tasks during the problem: 1) Attack and 2) The second seek, "Move to a close enough distance in order to attack" (That section starts with an Invertor on CanSeeObject), and 3) Patrol.

I tried various combinations of enabling/disabling them as below:

Case 1: [Attack DISABLED, Patrol Enabled, 2nd Seek Enabled] Works - As I back up, the Seek moves forward and always stays away at ArriveDistance. (Obviously no attack occurs)

Case 2: [Attack Enabled, Patrol Enabled, 2nd Seek DISABLED] The problem occurs - I continuously back up the player and the Agent is constantly brought directly into contact with the player. In this case Patrol has a red X.

Case 3: [Attack Enabled, Patrol DISABLED, 2nd Seek Enabled] The problem occurs but seems slightly better than Case 2.

Case 4: [Attack Enabled, Patrol DISABLED, 2nd Seek DISABLED] Only attack occurs, no approach to player

It seems like it's a combination of Attack with Patrol or Seek that is causing the problem. Almost like Patrol/Seek are setting a forward velocity that Attack is using?

Note: I set both player's Character Health to invincible and disabled the Health Flash to be able to watch. Attack Distance and Near Distance set to 8. ArriveDistance for the Seek is set to Attack Distance.
 
Last edited:

Justin

Administrator
Staff member
Alright, I had a look at the integration and everything looks like it is working as expected. There are two different Within Distance tasks - one to stop the character from getting too close initially:

1600627808647.png

And then another Within Distance task to stop the character from seeking if the target gets too far away:

1600627863626.png

The first Within Distance branch will only run one time at the start so if you want this check to always be performed you'll need to rearrange the tree a bit. The Within Distance task should be reevaluated using conditional aborts or a parallel task, and then if the agent gets too close you'll need to have them backup with a new movement task. The Movement Pack doesn't contain any tasks which restricts the agent to following within a certain distance but it is a good idea for a new task.
 
Top