Random generated debris in empty space

So I’m building a simple space game. Basically you’re able to float around at absolute freedom without any drag or gravity.

Here’s how it works:

  • I use rigidbody.AddForce to propel
    the player forward.
  • When player gets further than 100
    units from the center of the map, he,
    and every object is teleported back,
    seamlessly keeping him in the center
    of the map to avoid floating
    instabilities at extreme distances
    while maintaining the illusion of
    infinite space.
  • At the beginning of the level, a lot
    of debris models with rigidbodies are
    spawned within a radius of the
  • Certain events in the map delete all
    current debris floating around, and
    randomly spawns some new ones in a radius around the player.
  • The debris is in constant movement, and allows the player to bump into it, changing its and his velocity and rotation.

Here’s what I want:

  • When the player moves into an unexplored area, i want a script to automatically populate that area (within a large radius of the player. 1000 units to be exact) with debris from an array. If the player should return to an already populated area, the script should do nothing.

I thought about using chunks like most games with infinite worlds, but I’ve got no clue how to implement it.

Note: I write in C#.

the most efficient way would to be randomly generating the debris using a pool system, where you re use the objects you started with, and basically change their position and visibility.

but if your not worried about efficiency, using the chunks through LoadLevelAdditive, then having the new part of the level you loaded moved into place along with the character.

if this system is meant to specifically bypass getting floating point inaccuracy, try having the charachter stationary and only mess with his rotation, while instantiating, moving and destroying the debris instead of moving the character.

also scaling things down and lowering the speed lets the player seem to travel a lot farther while only moving a fraction of the distance.