Random point in a navigable "annular space"

Good day,

I’m currently working in an AI in which it will try to get distant to the player if it is close to it.

  • Is there a way to get a random point excluding the player avoidance circle from the random selection?
  • I think it is expensive if the process is to keep testing the random point until the distance of the player origin to the random point is greater than the radius of the avoidance circle?

As stated in the topic title, it should be in the annular space between the avoidance and the maximum allowed.

Image1 (Shows the annular space I’m referring)
Image2 (What I’m planning but can cause an infinite loop or a stall)

Thanks in advanced!

Hi [USER=“128497”]Agent Sckit[/USER]

A possible solution would be ,
Having the size of the minor circle, and the greater one,
Get the difference and create a vector with minor+ (random (greater-minor) )
This will give you a random vector surely in the right distance but random too.
Than add a rotation to the vector , a random Z

and you will always have a random but perffectly fine point

^ This ^ sounds like the best solution. But you could also use a doughnut shaped mesh, sized and placed to match the drawing.
Then experiment with node: GetClosestPointOnCollision (and if necessary GetActorBounds / RandomPointInBoundingBox).
But you need to fix the infinite loop first as you can’t do anything like that in BP (your game will eat CPU like the UE4 Launcher). :stuck_out_tongue:
Add a short delay to the false branch. But if the code is running inside a function then run it elsewhere as delays aren’t allowed!

Hahaha thats amazing XD

Thanks for the replies, I changed my approach drastically as I chose using the EQS thing. Well, actually that used to be random until I found out that EQS can do the job (make the AI move on the nearest spot but within the constrained range).