Jump to content

Recommended Posts

Posted

It's the first entity, so GetChild(scene,0) will return the terrain entity. You can also use FindChild("terrain"), but it's slower.

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 ■

Posted

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 ■

Posted

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

Posted

Make sure you scene variable is valid. I normally use the abstract system like "LoadScene("abstract::scene1.sbx") and scene 1 can be anywhere in your game dir and it'll find it and load it.

Posted

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 ■

Posted

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 ?

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.

×
×
  • Create New...