[Group Avoidance - RVOExampleAgent]


#1

Hi,

So I would like to adapt the RVOExampleAgent script for 3D environment and for multiple character.
I have a group of 10-15 character in block and I would like to have another character who can go through this group and each character of this group avoiding him as it is show in the RVO scene.

As you can see on this video :

The path is not really good… I think It could be better. ^^


#2

https://pastebin.com/ir3mbyq0


#3

Thanks for your answer. I just add it to another script but it need the RVOExampleAgent (modified or not) to work right?
This is my prefab.

The “MyAgent” script is the RVOExampleAgent modified and where I added your script part.
The NPCCharacter manage the animation
The NPCBehavior inherit from RichAI and is used to move the character to a target.

It’s actually work well but when my AI avoid the character, their RVOController.velocity.magnitude is not always inferior to 0.5, that make my units to rotate or be OnMove.

This is my NPCCharacter logic:

private void Update()
{
if (m_RVOController)
{
float cMagnitude = m_RVOController.velocity.magnitude;

        m_Animator.SetBool("OnMove", cMagnitude > 0.1f ? true : false);

        m_Animator.SetFloat("Speed", m_Animator.GetBool("OnMove") ? cMagnitude : 0);
        m_Animator.SetFloat("Direction", m_Animator.GetBool("OnMove") ? m_RVOController.velocity.y : 0);
    }

}


#4

My best guess would be that the Agent Time Horizon field on the RVOController is too large and your for your agents to find collision free trajectories for that amount of time leads them to take very conservative velocities.
Do you think you could post a screenshot of your RVOController settings?


#5

The value was 2 for “Agent Time Horizon”. I tried with a value of 1 but same… I think I don’t do it the right way.


#6

Are you sure you don’t have some other script that also tries to move the character?


#7

Hello, so yes the problem was that the RichAI and the RVOController tried together to move my character… that was the problem. It work really well now. Thank you for your help ! :slight_smile: And thank to @Dee_Lucky for the script. :smiley: