top of page
Asteroid Volume Spawn using Unreal 4.7/C++

    3D Volume that spawns objects at the outer limit and does not spawn any a certain distance from the origin.

 

(x - origin.x)^2 + (y - origin.y)^2 +

                     (z - origin.z)^2 <= radius^2

 

    When I learned the formula of a circle, I did not quite understand its application in the world.  On this project I found out how awesome it was.  The formula for every point inside a 2D circle including the outside edge was almost exactly what I needed.  I needed 3D though, so I actually just added the Z measurement and to my surprise it worked for a sphere.  Kind of...

 

    The first time I ran the program, all of the asteroids spawn only in one 8th of the sphere.  I realized that the x,y,z coordinates being fed into the equation were all positive.  I needed a way to make all three randomly positive of negative to place a point in all 8 sections of the sphere.  2^4.

 

    The last step was creating a measurement for the origin along the radius to mark off a volume that no asteroids could spawn.  

 

    The example video has 7000 spawned asteroids, which all show at once.  I have spawned 100,000, which worked but slowed the system down considerably.  I have not put in any system to hide object past a certain point.  I have also attempted to spawn 1 million asteroids but after 3 hours of attemping to build I stopped the process.  Memory was definatly a probleem at this point as every resource on my desktop was maxed out and more than likely just attemping to redo the same process over and over never progressing.  I am surprised it didn't crash.  
 

bottom of page