• News

• Industries

• Learning & Support

• Community

• Marketplace

"Get Random Point in Radius" creates very romantic hearts :P

Ok guys, this is indeed funny. I don’t know whether this is an “easter egg” which is intentionally build into the engine or just some strange bug…

I spawn tens of thousands of instances with “Get Random Point in Radius”. I only use X and Y of that random point, Z I set to 0. Now look what’s happening.

50000 Instances in a radius of 4000:

150000 Instances in a Radius of 10000:

This blueprint spawns the rocks:

Now please tell me, what is happening here? One of your software engeneers was so much in love that he accidentally (subconscious) built this “heart algorithm” in the random generator?

Maybe an Easter egg by an Epic staff for his girlfriend.

Often times more simple noise functions have artifacts in them. Though this is a bit unusual. Its likely a bug, due to how they are generating the points. Possibly from some ‘fast math’ approach given your radius, its having unusual floor/ceiling points.

I’d suggest just making your own get random point in circle function

Here is some Pseudo code
angle = random(0, 2pi); // pick a random direction
offset = random(0, radius); // pick a distance between 0 and the radius
x = offset * cos( angle ); // resolve the X coordinate
y = offset * sin( angle ); // resolve the Y coordinate

edit: I found something close to my pseudo code, https://forums.unrealengine.com/showthread.php?43732-Spawning-randomly-around-edge-of-a-circle-and-not-in-the-center&p=149371&viewfull=1#post149371 you’d want to swap out radius min for some lower bound (maybe 0) otherwise that should help out.

Note, you may need to do 0, 360. I am not sure which is expected of UE4’s Math’s Sin and Cosine function
this gets a random distance from 0 to the radius, at a particular angle, and cos resolves x of that angle, and sin for y respectively.

after looking thru the source, it appears the function GetRandomPointInRadius is actually intended for something to do with pathfinding and navigation meshes. So the points are likely biased for pathfinding algorithms somehow, and since you aren’t giving it input for that, its getting it some other way.

If you want random points in a circle, I’d advise you write your own function that either uses what I provided, or look on the internet. I don’t think that function is intended for that purpose, even though it appears like it might.

Make them all use separate rnd streams. One for location, one for rotation and one for scale.
I am curious if that thing will be there in this case also.

i suppose not very clear implementation of prng in engine, need to look closer
could you check your blueprint on another machine?

Don’t ruin my Valentine’s Day surprise!

Hahaha… I bet she already knows.

Is it fixed in 4.7?

No, it’s not fixed.

This has now been fixed internally and you should see the fix publicly in a future release, but no the upcoming hotfix.