Jump to content

Get Terrain from Scene


DanielW
 Share

Recommended Posts

I just looked at gamelib, and there I get the terrain in 3 steps:

 

e=GetChild(scene,i);

...

cl=GetEntityKey(e,"class");

...

 

if( cl=="Terrain" )

{

// printf("******** FOUND TERRAIN ********\n");

terrain = e;

SetEntityKey(e,"status","handled");

}

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

Ok have tryed this:

 

TTerrain terrain;
TEntity scene=LoadScene("scene/scene1.sbx");	   
int i;
for(i=0;i<CountChildren(scene);i++)
{
 TEntity e = GetChild(scene,i);
 str cl = GetEntityKey(e,"class");
 if(cl=="Terrain")
 {
 terrain = e;
 SetEntityKey(e,"status","handled");
 }
}

 

when i try to debug its still quits while its loading

Link to comment
Share on other sites

Use string, not str for cl. str is just unsigned char*, and does not support == comparison.

I recommend to copy paste shamelessly any code from gamelib, because it just works and is tested. If you can do it better, please do so, but it won't be tested, unless you test it yourself smile.png

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

its still dont working when i delete GetChild elverything Loads but with it it starts Loading elveryting and then quits whitout any message or error.

 

didnt know of the gamelib in the assetstore will give it a look thanks

 

edit: in my scene i have only the Terrain an Atmosphere and light do i need there something more ?

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.

Guest
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.

 Share

×
×
  • Create New...