Archive 17/01/2023.

Use terrain and UIComponent

baiyqukq

In “Hello3DGUI” sample, if create a terrain, just copy the code from “VehicleDemo”, there are lots of warnings:
WARNING: RAY_TRIANGLE_UV query level is not supported for TerrainPatch component

1vanK

Looks like we need way to set ray mask for UIComponent

baiyqukq

Thank you. I have added “CHECK” code and tested, but warnings still appear, and performance is bad as before.

Eugene

Can you check what callstack leads to this warning? Who is trying to ray-cast TerrainPatch with level RAY_TRIANGLE_UV?

1vanK

Who is trying to ray-cast TerrainPatch with level RAY_TRIANGLE_UV ?

UIComponent

baiyqukq

Making this warning is very simple, just copy code from 19_VehicleDemo in CreateScene() as follow:
// Create heightmap terrain with collision
Node* terrainNode = scene_->CreateChild(“Terrain”);

shape->SetTerrain();
To 48_Hello3DUI sample in InitScene() as follow:
light->SetSpecularIntensity(0.5f);
###copied here###
auto* zone = scene_->CreateComponent();

callstack:
1 Urho3D::TerrainPatch::ProcessRayQuery TerrainPatch.cpp 113 0xa21a42
2 Urho3D::Octant::GetDrawablesInternal Octree.cpp 273 0x60eab9
3 Urho3D::Octant::GetDrawablesInternal Octree.cpp 280 0x60eb0d
4 Urho3D::Octant::GetDrawablesInternal Octree.cpp 280 0x60eb0d
5 Urho3D::Octant::GetDrawablesInternal Octree.cpp 280 0x60eb0d
6 Urho3D::Octree::Raycast Octree.cpp 506 0x60fffb
7 Urho3D::UIElement3D::ScreenToElement UIComponent.cpp 120 0x4324a0
8 Urho3D::UI::GetElementAt UI.cpp 796 0x439f0d
9 Urho3D::UI::ProcessHover UI.cpp 1346 0x43c3ad
10 Urho3D::UI::Update UI.cpp 376 0x438100
11 Urho3D::UI::HandlePostUpdate UI.cpp 2048 0x43f8d2
12 Urho3D::EventHandlerImplUrho3D::UI::Invoke Object.h 323 0x44aae9
13 Urho3D::Object::OnEvent Object.cpp 127 0x6aa1b6
14 Urho3D::Object::SendEvent Object.cpp 364 0x6aacc9
15 Urho3D::Engine::Update Engine.cpp 696 0x691902
16 Urho3D::Engine::RunFrame Engine.cpp 517 0x691254
17 Urho3D::Application::Run Application.cpp 86 0x69de05
18 RunApplication Hello3DUI.cpp 53 0x40a163
19 main Hello3DUI.cpp 53 0x40a1fd