Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Initial Version and Version 1 of ~archive/WorldEntity


Ignore:
Timestamp:
Nov 27, 2007, 11:41:37 PM (16 years ago)
Author:
landauf
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • ~archive/WorldEntity

    v1 v1  
     1= WorldEntity =
     2A WorldEntity is an extension ParentNode, that can be displayed, and interact in the wonderful Worlds of orxonox
     3
     4source:/trunk/src/world_entities/world_entity.h#HEAD [[br]]
     5__Dependecies__:
     6  * ParentNode
     7
     8== usage ==
     9{{{
     10#!cpp
     11  void loadParams(const TiXmlElement* root);
     12  void loadModel(const char* fileName, float scaling = 1.0f);
     13  bool buildObbTree(unsigned int depth);
     14  void setVisibiliy (bool visibility) { this->bVisible = visibility; };
     15
     16  virtual void postSpawn ();
     17  virtual void leftWorld ();
     18
     19  virtual void tick (float time);
     20  virtual void draw () const;
     21  virtual void collidesWith (WorldEntity* entity, const Vector& location);
     22}}}
     23'''Initailisation-Phase:'''
     24  * __loadParams__: Loads Parameters on the WorldEntity - level
     25  * __loadModel__: loads a new Model onto the WorldEntity (this is coppled with the ResourceManager, so you don't have to care about the pointer anymore)
     26  * __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.
     27  * __setVisibility__: Tells the ENGINE if this WorldEntity must be drawn, or not
     28 
     29'''Runtime'''
     30  * __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.
     31  * __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.
     32  * __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.
     33
     34'''other functions'''
     35All the other functions to be read about in the Source-Documentation
     36
     37
     38== Howto Create a new WorldEntity ==
     39If you want to create a new WorldEntity, you first have to know the concept of
     40  * ClassID, BaseObject (for nice integration into our project)
     41  * LoadParam / Factory (for automatic Loading)
     42
     43Then it would be a good idea to look at an other WorldEntity, like Player/NPC/PowerUp.
     44
     45__Creation Process__:
     46  1. ''Copy'' src/proto/proto_world_entity.[cc,h] to src world_entities/you_entity.[cc,h]
     47  2. ''Rename'' all the ProtoWorldEntities to !YourOwnName (look at all cases, PROTO_WORLD_ENTITY, proto_world_entity.h)
     48  3. ''add'' your new ClassID to src/defs/class_id.h -> write a mail to orxonox-dev-mailingList, if you have problems with this
     49  4. ''Peek'' at some the other WorldEntities, to get the hang of the functionality
     50  5. ''be'' creative :)