Jump to content

World access


george68
 Share

Recommended Posts

Hi,

I cannot access all the entities in the start.map file using the following code:

.
.
.
bool App::Start()
{
   window = Window::Create("Hello World", 100, 100, 1024, 768, Window::Titlebar);
   context = Context::Create(window);
   world = World::Create();

   if (Map::Load("Maps/start.map"))
   {
       for (std::list<Entity *>::iterator it=world->entities.begin(); it != world->entities.end(); it++)
       {
           Entity *ent = *it;

           if (ent)
           {
               int class_id=ent->GetClass();
               std::string class_name=ent->GetClassName();
               std::string keyval=ent->GetKeyValue("name");
           }
       }
   }
   return true;
}
.
.
.

Although the class_name is "Model" the keyval is an empty string ""

Also iterating the Map I found only one model instead of two, a directional light and a camera

I don't know what I am doing wrong.

Link to comment
Share on other sites

Hi,

are the missing models imported meshes or are they brushes (i.e. simple forms created in the editor, like boxes, spheres, etc)?

In the latter case, it is important to know, that they get collapsed, so that they are only one model, which has several advantages with respect to performance.

You can prevent them from being collapsed by either giving them a mass =/= 0 or by assigning a script (just a dummy one is enough).

Link to comment
Share on other sites

They are brushes. I don't know how to convert them to meshes using the editor.

I am new to the editor and the leadwerks in general. I don't think they are one model.

It is the map that comes with the default installation.

Thats what Ma-Shell is telling you. If its a CSG object and it doesn't have a mass >0 or a script attached to it, it will be collapsed into one object for performance increase (behind the scenes automatically). If you want to be able to list the CSG created object via code as you have shown above, then give it a mass greater than 0 or add a script to it in the Editor.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

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