.. _api_World: World ===== Inherited: :ref:`Object` .. _api_World_description: Description ----------- Note: A World object creating automatically by the engine. Only one World instance can be created in the game. A World object must be set as a parent for other game hierarchies to show them on the screen. The main scene graph object can be retrieved using Engine::world() .. _api_World_public: Public Methods -------------- +------------------------------+-------------------------------------------------------------------------------------------+ | :ref:`Scene` * | :ref:`activeScene` () const | +------------------------------+-------------------------------------------------------------------------------------------+ | void | :ref:`activeSceneChanged` () | +------------------------------+-------------------------------------------------------------------------------------------+ | :ref:`Scene` * | :ref:`createScene` (const TString & name) | +------------------------------+-------------------------------------------------------------------------------------------+ | :ref:`Object` * | :ref:`gameController` () const | +------------------------------+-------------------------------------------------------------------------------------------+ | void | :ref:`graphUpdated` () | +------------------------------+-------------------------------------------------------------------------------------------+ | bool | :ref:`isActive` () | +------------------------------+-------------------------------------------------------------------------------------------+ | :ref:`Scene` * | :ref:`loadScene` (const TString & path, bool additive) | +------------------------------+-------------------------------------------------------------------------------------------+ | bool | :ref:`rayCast` (const Ray & ray, float maxDistance, Ray::Hit * hit) | +------------------------------+-------------------------------------------------------------------------------------------+ | void | :ref:`sceneLoaded` () | +------------------------------+-------------------------------------------------------------------------------------------+ | void | :ref:`sceneUnloaded` () | +------------------------------+-------------------------------------------------------------------------------------------+ | void | :ref:`setActive` (bool flag) | +------------------------------+-------------------------------------------------------------------------------------------+ | void | :ref:`setActiveScene` (Scene * scene) | +------------------------------+-------------------------------------------------------------------------------------------+ | void | :ref:`setGameController` (Object * controller) | +------------------------------+-------------------------------------------------------------------------------------------+ | void | :ref:`setRayCastHandler` (RayCastCallback callback, System * system) | +------------------------------+-------------------------------------------------------------------------------------------+ | void | :ref:`unloadAll` () | +------------------------------+-------------------------------------------------------------------------------------------+ | void | :ref:`unloadScene` (Scene * scene) | +------------------------------+-------------------------------------------------------------------------------------------+ .. _api_World_static: Static Methods -------------- None .. _api_World_methods: Methods Description ------------------- .. _api_World_c8250d74: :ref:`Scene` * **World::activeScene** () const Returns an active Scene. There must always be one Scene marked as the active at the same time. **See also** setActiveScene(). ---- .. _api_World_e63c592a: void **World::activeSceneChanged** () Emmits signal when active scene has been changed. ---- .. _api_World_d9f5b20a: :ref:`Scene` * **World::createScene** (:ref:`TString` & *name*) Create an empty new Scene at runtime with the given name. ---- .. _api_World_2d37c85a: :ref:`Object` * **World::gameController** () const Returns a game controller object. Game controller is abstract object respocible for various gameplay aspects. **See also** setGameController(). ---- .. _api_World_29b571df: void **World::graphUpdated** () Emmits signal when graph has been updated. ---- .. _api_World_8e36509d: bool **World::isActive** () Returns in case of world is active and must be updated in the current frame; otherwise returns false. ---- .. _api_World_4a25dc19: :ref:`Scene` * **World::loadScene** (:ref:`TString` & *path*, bool *additive*) Loads the scene stored in the .map files by the it's path. **Note:** The previous scenes will be not unloaded in the case of an *additive* flag is true. ---- .. _api_World_4ef1a708: bool **World::rayCast** (:ref:`Ray` & *ray*, float *maxDistance*, :ref:`Ray::Hit` * *hit*) Casts a ray, of length maxDistance, against all colliders in the World. Returns true if the *ray* has a *hit* point with a Collider; otherwise returns false. ---- .. _api_World_ed74c2f9: void **World::sceneLoaded** () Emmits signal when scene has been loaded. ---- .. _api_World_b1d85fe9: void **World::sceneUnloaded** () Emmits signal when scene has been unloaded. ---- .. _api_World_52e894cd: void **World::setActive** (bool *flag*) Sets an active flag. For active worlds engine launches the simulation. **See also** isActive(). ---- .. _api_World_c986273f: void **World::setActiveScene** (:ref:`Scene` * *scene*) Sets the *scene* to be active. There must always be one Scene marked as the active at the same time. **See also** activeScene(). ---- .. _api_World_9edac71f: void **World::setGameController** (:ref:`Object` * *controller*) Sets the game controller. Game *controller* is abstract object respocible for various gameplay aspects. **See also** gameController(). ---- .. _api_World_13864fdc: void **World::setRayCastHandler** (:ref:`RayCastCallback` *callback*, :ref:`System` * *system*) Sets the raycast *callback* function. This function will be used to check intersections with in game geometry. In the most cases implemented in the physical engines. This *callback* is added by any physical *system* by the default. ---- .. _api_World_9dcfb756: void **World::unloadAll** () Unloads all from the World. ---- .. _api_World_d829f657: void **World::unloadScene** (:ref:`Scene` * *scene*) Unloads the *scene* from the World.