Jump to content

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


Virtual Magic Games
 Share

Recommended Posts

Hello,

 

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,

Marcin

Link to comment
Share on other sites

Is the chance for any advice in that topic ? 🙂

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
 Share

×
×
  • Create New...