battlegear2099 Posted December 21, 2023 Share Posted December 21, 2023 Syntax //Apply material based on terrain slope for (int x = 0; x < terrain->resolution.x; ++x) { for (int y = 0; y < terrain->resolution.y; ++y) { float slope = terrain->GetSlope(x, y); if (slope > 15.0f) { float wt = Min((slope - 15.0f) / 10.0f, 1.0f); terrain->SetMaterial(x, y, rocks, wt); <-----------------? } } } void SetMaterial(shared_ptr<Material> material)..... 1 Quote Link to comment Share on other sites More sharing options...
Josh Posted December 21, 2023 Share Posted December 21, 2023 Thank you for finding this! There was a change to the API during development and this example was not updated to reflect that. I will fix it tomorrow morning. Instead, applications should use Terrain::AddLayer: https://www.ultraengine.com/learn/Terrain_AddLayer?lang=cpp And Terrain:SetLayerWeight: https://www.ultraengine.com/learn/Terrain_SetLayerWeight?lang=cpp 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
battlegear2099 Posted December 21, 2023 Author Share Posted December 21, 2023 np, I am just starting to look at docs and testing your engine , ok I will test it again when you make the change. also I got a error testing loadModel code or load plugin . it errors with a end of file error on loading textures, I was able to download the textures and save them local and rewrite it for local and it worked. so might want to test that, not sure if it was just my local firewall or its the file. Quote Link to comment Share on other sites More sharing options...
Solution Josh Posted December 24, 2023 Solution Share Posted December 24, 2023 Thanks for reporting this. I have fixed the code example here: https://github.com/UltraEngine/Documentation/blob/master/CPP/Terrain_GetSlope.md It will take a few hours for the cached page on our site to refresh. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.