Jump to content

Terrain FindChild problem


Recommended Posts

I think FindChild is looking for the "name" key, and not the "class" key.

GameLib gets the terrain entity correctly by looking for "class"=="Terrain".

If you don't want to use GameLib, you could just copy the function GetFirstEntityByKey(key,value) from it, and use it as: terrain = GetFirstEntityByKey("class","Terrain");.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

I Also thought about that,

but every time when i test it, it was the last chil.


But, i have one more question, why does this two ways to get the terrain height doesn´t work:

First Way:

VObject::kiObject->Y = TerrainHeight(cTerrain, kiObject->X*2,kiObject->Y*2); // 2 is the Meter per tile


Second way:

	if(LinePick(&cPick, Vec3(kiObject->X,kiObject->Y,kiObject->Z), Vec3(kiObject->X,kiObject->Y-10,kiObject->Z), 5))
		kiObject->Y = cPick.Y;
		std::cout << cPick.Y << std::endl;


Can some one help me?




Link to comment
Share on other sites

The first way doesn't work because you use y as the z position, I think it should be:

VObject::kiObject->Y = TerrainHeight(cTerrain, kiObject->X*2,kiObject->Z*2); // 2 is the Meter per tile


and for the second way: make sure you use 0 as the pick radius, anything else doesn't work. (set your 5 to 0)

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...