This class holds the hierarchy of game entities that populate a game world. More...
Public Member Functions | |
object | new (string ClassName, string InstanceName="") |
This method creates new game entities or new entity components. More... | |
EntityT | GetRootEntity () |
Returns the root entity of this world as previously set by SetRootEntity(). More... | |
SetRootEntity (EntityT ent) | |
Sets the root entity for this world. More... | |
table | TraceRay (table Start, table Ray) |
Employs m_ClipWorld->Trace() to trace a ray through the (clip) world. More... | |
table | Phys_TraceBB (table BB, table Start, table Ray) |
Employs m_PhysicsWorld->TraceBoundingBox() to trace a bounding-box through the (physics) world. More... | |
This class holds the hierarchy of game entities that populate a game world.
The root of the hierarchy is the map entity, all other entities are direct or indirect children of it.
This class represents the world that is defined in a .cent
script file as a whole. Its methods affect the entire world, not just a single entity of its entity hierarchy. (The new() method described below is an exception: It is used to create new entities and new components.)
Note that you never create WorldT instances yourself: Instead, each game script accesses the global world
variable that is automatically predefined. Thus, the methods of the WorldT class are always used like this:
EntityT GetRootEntity | ( | ) |
Returns the root entity of this world as previously set by SetRootEntity().
object new | ( | string | ClassName, |
string | InstanceName = "" |
||
) |
This method creates new game entities or new entity components.
ClassName | The name of the class of which an object should be created. Use "EntityT" in order to create a new EntityT. Use any class name from the ComponentBaseT hierarchy in order to create a new component, for example "ComponentModelT" in order to create a new model component. |
InstanceName | The name that the newly created entity instance is assigned. Specifying a name for an entity is equivalent to setting the Name attribute of its Basics component; see the example above and ComponentBasicsT.Name for details. Setting a proper entity instance name is important so that other script code can unambiguously find and identify the entity by name later. The CaWE Map Editor also uses it in order to automatically create the initialization script code in the .cent files. This parameter is not used (and in fact ignored) for components, which have no individual object names. |
table Phys_TraceBB | ( | table | BB, |
table | Start, | ||
table | Ray | ||
) |
Employs m_PhysicsWorld->TraceBoundingBox() to trace a bounding-box through the (physics) world.
Note that this method is only useful with entities that do not have a collision model of their own, because it currently is not capable to ignore specific collision models (the entity's) for the trace, which was a necessity in this case.
SetRootEntity | ( | EntityT | ent | ) |
Sets the root entity for this world.
If you use the Map Editor that is part of the CaWE application, a proper call to this method is automatically included in the generated files.
ent | The entity that is set as the root entity of this world. |
table TraceRay | ( | table | Start, |
table | Ray | ||
) |
Employs m_ClipWorld->Trace() to trace a ray through the (clip) world.