Crystal Space
Welcome, Guest. Please login or register.
October 24, 2014, 07:54:18 pm

Login with username, password and session length
Search:     Advanced search
9011 Posts in 2044 Topics by 8816 Members
Latest Member: Hejduczo
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  how to get the mesh object's name?
« previous next »
Pages: [1] Print
Author Topic: how to get the mesh object's name?  (Read 2308 times)
Jr. Member
**
Posts: 81


View Profile Email
« on: October 30, 2008, 08:41:28 am »

    I am new in CS and CEL;
    When I run the walktut in CEL , I found some questions, plesae help me !!

       1. In "walktut_world" file it defines a lot of mesh objects like "cube.001, cube.002, ……" ,I don't know what are the meaning of them, are they mean rooms in the world or other things?

       2. In "walktut_world" application , it mentions "region" and "zone" many times and when it create a player and put the player in a region ,it uses a region's name to put the player into the region, the code is followed:

  csRef<iPcMesh> pcmesh = CEL_QUERY_PROPCLASS_ENT (player_entity, iPcMesh);
  pcmesh->SetPath ("/cellib/objects");
  pcmesh->SetMesh ("test", "cally.cal3d");
  if (!pcmesh->GetMesh ())
    return ReportError ("Error loading model!");

  if (pczonemgr->PointMesh ("player", "main", "Camera"))
    return ReportError ("Can't find region or start position in region!");

 but in "walktut_world" file I can't found the region name "main" , I don't know how is it to get the region's name?

Please help me! Thank you very much!!!
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #1 on: October 30, 2008, 09:06:11 am »

Mesh objects are geometrical objects. i.e. things you can see and that have a triangle mesh.

Walktut uses the default region. That is not defined in the world file. It is created automatically inc code.

Greetings,
Logged
Jr. Member
**
Posts: 81


View Profile Email
« Reply #2 on: October 30, 2008, 09:52:13 am »

   The game world is make up of many rooms, and they are named when they are builded. How can i get the name of the room using c++ code?
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #3 on: October 30, 2008, 09:53:16 am »

I suppose you mean sectors? For any CS object (sector, mesh object, factory, ...) you can always do object->QueryObject()->GetName() to get the name.

Greetings,
Logged
Jr. Member
**
Posts: 81


View Profile Email
« Reply #4 on: October 30, 2008, 10:02:07 am »

   uh, Yes, it is!!!  Thank you!!
   
   In walktut application,   it is using the code to build a zone and region with the name of "main", then loading the world of  "walktut_world"  for the game,  Is the zone/region means "walktut_world" . or they are only the part of the world?!

The code to build the zone and region is follow:

csRef<iPcZoneManager> zonemgr = CEL_QUERY_PROPCLASS_ENT (level_entity,
     iPcZoneManager);
  iCelZone* zone = zonemgr->CreateZone ("main");
  iCelRegion* region = zonemgr->CreateRegion ("main");
  zone->LinkRegion (region);
Logged
Jr. Member
**
Posts: 81


View Profile Email
« Reply #5 on: October 30, 2008, 10:12:31 am »

  Now i get a point which points to sector , if a want to get the name of the sector , can i do like this :

   iSector* sector = pcmesh->GetMesh ()->GetMovable ()->GetSectors ()->Get (0);
   char *name = sector->QueryObjec->GetName();
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #6 on: October 30, 2008, 11:28:07 am »

yes almost. Use QueryObject(). Not QueryObjec

Greetings,
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 7.19 seconds with 17 queries.