Jump to content

Terrain Loader Manager - searching terrains in range is a bit slow

Virtual Magic Games

Recommended Posts



I need to write a bit of code, that checks if terrain under certain point is loaded or not (to avoid objects falling). I was looking at the code inside TerrainLoaderManager class and I found that there is foreach loop, that checks bounds of every single terrain. We have 384 terrains and it takes a while (around 2ms), so my question is: do you have any more optimise code that is able to find terrain at certain point? This should be quite easy, because terrains are organised into grid. 


Thanks in advance,


Link to comment
Share on other sites

Hi, the code piece you found was not written with performance in mind as it is only going to be called from within the editor and not permanently each frame during runtime / realtime. We do not have any optimized code for this task available at the moment.
If your terrains are all created by Gaia and you know the dimensions, you could get the terrain name according to the position by dividing the x and z position by the dimensions to figure out the terrain scene name that would contain the point.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

  • Create New...