I have a PackedVector3Array that stores Vector3 coordinates in the shape of a sphere. I would like to load individual meshes at these points when a player is within range of them. What would be the best way to go about doing this?

I recently watched this awesome video, where they load in stars using blocks of world space. I think what I would like to accomplish is something similar to this, only my "stars" are the predefined points along my sphere, so not random.

I would like to load a mesh when the player comes into proximity of a vector3 point in the array, how could I set this up?

  • xyz replied to this.
  • dizzy The amount of points is scalable

    Sure but you need to have a ballpark. If the limit of points is relatively low, you can get away with linear search. Otherwise you'll need to employ one of the recursive space partitioning schemes, like k-d tree, bsp tree or quad tree.

    dizzy changed the title to Proximity Loading using Array of Vector3s? .

    dizzy How many points? Are they only on surface of the sphere or anywhere in the sphere?

      xyz The amount of points is scalable, only on the surface

      • xyz replied to this.

        dizzy The amount of points is scalable

        Sure but you need to have a ballpark. If the limit of points is relatively low, you can get away with linear search. Otherwise you'll need to employ one of the recursive space partitioning schemes, like k-d tree, bsp tree or quad tree.

          xyz Apologies, yeah there's too many points for linear search. Going to look more into recursive space partitioning, but from what I'm understanding I can use the players location to mark their 3D quadrant, and then find all the Vector3 points inside of that quadrant?
          Either way I was able to find this video tutorial, which I can see helping me out a lot so thanks for pointing me in the right direction!