Random point inside of a sphere

I know in Unity there is a function Random.insideUnitSphere that allows you to get a random point inside of a sphere. Is there an equivalent BP function in UE4 or do I have to construct my own system? idea is that I want to randomly spawn enemies within a radius.

Hi eviltenchi,

I believe this is node you’re looking for:

https://docs.unrealengine.com/latest/INT/BlueprintAPI/AI/Navigation/GetRandomPointinRadius/index.html

Hope that helps!

I tried that node once before and it never seemed to work properly. Do you have to connect Nav Data for this to work?

Nope. What exactly about it didn’t work?

It was not returning a vector when I called it

Oh, I apologize, that only works in conjunction with Navigation system. If you’re not using a NavMesh, it won’t work.

Instead, you can use three Get Random Float in Range nodes and plug them into a Make Vector node. If you’re looking for a 100 radius, use -100 and +100 for Min and Max on each.

Okay, was just wondering if there was a BP node equivalent of one in Unity. Thanks.

Wow, this is an oldie. For funsies:

FVector RandomInsideUnitSphere() 
{
  return FMath::FRand() * FRotator(FMath::FRandRange(-90, 90), FMath::FRandRange(0, 360), 0).Vector();
}