Support Forum

How to besiege player?

hello,
I’m a new developer.In my game,some tanks move towards player.When they are a certain distance away from the player,they will stop and shoot like a fan.Following image displays this.I try many ways to realize it.But it is not very good.
QQ截图20230119132714
QQ截图20230119132741

First,I only use RichAI component and enable collider.they stack.
QQ截图20230119132804
Then,I use RVOController to pathfind.But some tanks stuck in local optimum.
QQ截图20230119132817
Then,I use navmeshcut.When the tank start to shook,I make navmeshcut enable=true.It achieve my purpose.But I don’t know how to disable it when tank start to move.Need I remove the componment by script?Is there any other better way to implement it?Thank you for your reply.
update:As for “enable=true”,it is my fault and write a wrong script.And the players is more than one.

Regarding the positioning I would suggest to calculate the desired positions around the target. Depending on how many unity attack that one target, calculate the points and assign one to each unit. Maybe the easiest way to do this is to define a certain number of slots around a target. For every unit you search for the closest unoccupied slot and assign the unit to it.
image

Regarding the navmesh cut: I don’t have enough knowledge about the pathfinding part to give good advice, but you have to assign or calculate the new path for the units at some point. Can’t you set navmeshcut.enabled=false there?

My player is not one,If I use the method,maybe some tanks will stay in wrong positon.But it’s really a good way to solve it when facing one target.If I use this to ambush one player in some Emergencies events,it is very useful.As for the “enabled”,haha,I write a error script,which always makes navmeshcut component enable.Thank for your suggestion.

The beta version has improved avoidance of locked RVOAgents (https://arongranberg.com/temp/rts_demo_locked.mp4).
I think that could be a solution to your issues. Essentially, you have to ensure that you set RVOController.locked=true when the other agents reach their goal and start shooting.

Ok,I will try it.The video looks like very good.It don’t stuck between two agents.