= !WorldEntity = A !WorldEntity is an extension [wiki:archive/ParentNode ParentNode], that can be displayed, and interact in the wonderful Worlds of orxonox source:/trunk/src/world_entities/world_entity.h#HEAD [[br]] __Dependecies__: * [wiki:archive/ParentNode ParentNode] == usage == {{{ #!cpp void loadParams(const TiXmlElement* root); void loadModel(const char* fileName, float scaling = 1.0f); bool buildObbTree(unsigned int depth); void setVisibiliy (bool visibility) { this->bVisible = visibility; }; virtual void postSpawn (); virtual void leftWorld (); virtual void tick (float time); virtual void draw () const; virtual void collidesWith (WorldEntity* entity, const Vector& location); }}} '''Initailisation-Phase:''' * __loadParams__: Loads Parameters on the !WorldEntity - level * __loadModel__: loads a new Model onto the !WorldEntity (this is coppled with the [wiki:archive/ResourceManager ResourceManager], so you don't have to care about the pointer anymore) * __buildObbTree__: If you want collisions to happen onto this !WorldEntity, then you have to call this function, to create a Collision-Cluster. This is normally called upon a call to loadModel, but maybe you want something more. * __setVisibility__: Tells the ENGINE if this !WorldEntity must be drawn, or not '''Runtime''' * __tick__: Tells this !WorldEntity, to step around a little timestep (dt) into the future (or past if (dt < 0)). All derived Classes should reimplement this function, to describe the behaviour of the !WorldEntity over time. * __draw__: Tells this !WorldEntity to draw itself. This function should be reimplemented virtually by all derived classes. Most Classes are drawn differently. The default drawing function is quite good, but maybe not, what you are looking for. * __collidesWith__: If a Collision has happened, this function is called. Here you get the Entity that collided with this one, and the location, where the hit occured. '''other functions''' All the other functions to be read about in the Source-Documentation == Howto Create a new !WorldEntity == If you want to create a new !WorldEntity, you first have to know the concept of * ClassID, [wiki:archive/BaseObject BaseObject] (for nice integration into our project) * [wiki:archive/LoadParam LoadParam] / Factory (for automatic Loading) Then it would be a good idea to look at an other !WorldEntity, like Player/NPC/PowerUp. __Creation Process__: 1. ''Copy'' src/proto/proto_world_entity.[cc,h] to src world_entities/you_entity.[cc,h] 2. ''Rename'' all the !ProtoWorldEntities to !YourOwnName (look at all cases, PROTO_WORLD_ENTITY, proto_world_entity.h) 3. ''add'' your new ClassID to src/defs/class_id.h -> write a mail to orxonox-dev-mailingList, if you have problems with this 4. ''Peek'' at some the other !WorldEntities, to get the hang of the functionality 5. ''be'' creative :)