Search Unity

Trying to implement spacial hashing job like you guys did in the video.

Discussion in 'Entity Component System' started by Wigen, Feb 13, 2018.

  1. Wigen

    Wigen

    Joined:
    Aug 31, 2013
    Posts:
    33
    I am trying to build out the spacial hashing structure in a job. Did you guys use "NativeHashMap" or were you guys doing something else?
    Lists and arrays inside the structs don't quite work in the jobs themselves. so the only thing i can think of to create the structure is to say i have a 100X100 grid, and assume i can have -up to- 100 elements in each grid.. flatten it out so its a single array of 100X100 x 100 then i can math out which section the element can go into and go down the array till there is an open spot, or make a struct that has the 100 elements individually so it would be 100 X 100 (each with 100 ints in it + current length. These just feel super hacky. Anyone have any suggestions?
     
    Last edited: Feb 13, 2018
  2. recursive

    recursive

    Joined:
    Jul 12, 2012
    Posts:
    669
    I don't think they've rolled any data structures other than NativeArray<> and NativeSlice<> into the betas yet.
     
  3. MartinGram

    MartinGram

    Administrator

    Joined:
    Feb 24, 2017
    Posts:
    72
    Yes, NativeHashMap was used extensively for the demo shown in the Austin Keynote video.

    As recursive says, currently only NativeArray and NativeSlice are exposed in the beta for now.