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
- 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#.