Search Unity

( Density ? ) Generate a part of a randomly generated structure

Discussion in 'Scripting' started by zenden_1, Jan 12, 2020.

  1. zenden_1

    zenden_1

    Joined:
    May 20, 2017
    Posts:
    53
    Hi, my project is to generate the point in the area where my player is ( green point ). I have to generate each area with a seed to regenerate it when i need but at no time I have generate the entire galaxy.

    My problem is actually that i dont know how i can generate the white points in area where the green point is without generate the rest of the structure. I heard about density and poisson but no more.

     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    if you already generated the whole galaxy, can collect those stars into each cell (when/after its generated)
    could be just a regular list to hold each star, its position and other info if needed.

    but if you must regenerate points inside that cell from scratch, without going through whole galaxy generation and just skipping stars outside the cell, then not sure how to do that..

    i guess this is your generation formula,
    https://forum.unity.com/threads/for...he-arms-of-a-spiral-galaxy-less-dense.682834/
     
  3. zenden_1

    zenden_1

    Joined:
    May 20, 2017
    Posts:
    53
    Yes it's actually my generation formula and i'm in the second case that you have say.

    btw, thank to you because i totally forgot that i put my code in this forum and i'd lost him.
     
  4. exiguous

    exiguous

    Joined:
    Nov 21, 2010
    Posts:
    1,749
    Maybe this article gives some insight.
    Also this article gives a (very) short description. It is a web archive link because the original site does not load properly for me any more.

    Basically what you could do is to just generate stars for the whole sector and compare their positions towards the "density" of you mask function and only allow those above a given threshold.