WorldΒΆ

Inherited: Object

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()

Public MethodsΒΆ

Scene *

activeScene () const

void

activeSceneChanged ()

Scene *

createScene (const TString & name)

Object *

gameController () const

void

graphUpdated ()

bool

isActive ()

Scene *

loadScene (const TString & path, bool additive)

bool

rayCast (const Ray & ray, float maxDistance, Ray::Hit * hit)

void

sceneLoaded ()

void

sceneUnloaded ()

void

setActive (bool flag)

void

setActiveScene (Scene * scene)

void

setGameController (Object * controller)

void

setRayCastHandler (RayCastCallback callback, System * system)

void

unloadAll ()

void

unloadScene (Scene * scene)

Static MethodsΒΆ

None

Methods DescriptionΒΆ

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


void World::activeSceneChanged ()

Emmits signal when active scene has been changed.


Scene * World::createScene (TString & name)

Create an empty new Scene at runtime with the given name.


Object * World::gameController () const

Returns a game controller object.

Game controller is abstract object respocible for various gameplay aspects.

See also setGameController().


void World::graphUpdated ()

Emmits signal when graph has been updated.


bool World::isActive ()

Returns in case of world is active and must be updated in the current frame; otherwise returns false.


Scene * World::loadScene (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.


bool World::rayCast (Ray & ray, float maxDistance, 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.


void World::sceneLoaded ()

Emmits signal when scene has been loaded.


void World::sceneUnloaded ()

Emmits signal when scene has been unloaded.


void World::setActive (bool flag)

Sets an active flag. For active worlds engine launches the simulation.

See also isActive().


void World::setActiveScene (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().


void World::setGameController (Object * controller)

Sets the game controller.

Game controller is abstract object respocible for various gameplay aspects.

See also gameController().


void World::setRayCastHandler (RayCastCallback callback, 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.


void World::unloadAll ()

Unloads all from the World.


void World::unloadScene (Scene * scene)

Unloads the scene from the World.