Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8186 in orxonox.OLD for trunk/src/world_entities


Ignore:
Timestamp:
Jun 7, 2006, 2:40:46 PM (18 years ago)
Author:
bensch
Message:

trunk: merged the branche bsp_model back here

Location:
trunk/src/world_entities
Files:
3 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/WorldEntities.am

    r8068 r8186  
    1515                world_entities/test_entity.cc \
    1616                world_entities/planet.cc \
     17                world_entities/bsp_entity.cc \
    1718                \
    1819                world_entities/weapons/test_gun.cc \
     
    6768                test_entity.h \
    6869                planet.h \
     70                bsp_entity.h \
    6971                \
    7072                weapons/test_gun.h \
  • trunk/src/world_entities/world_entity.cc

    r8037 r8186  
    312312
    313313/**
     314 *  this function is called, when two entities collide
     315 * @param entity: the world entity with whom it collides
     316 *
     317 * Implement behaviour like damage application or other miscellaneous collision stuff in this function
     318 */
     319void WorldEntity::collidesWithGround(const Vector& location)
     320{
     321  PRINTF(0)("BSP_GROUND: %s collides \n", this->getClassName() );
     322}
     323
     324void WorldEntity::collidesWithGround(const Vector& feet, const Vector& ray_1, const Vector& ray_2)
     325{
     326 
     327  // PRINTF(0)("BSP_GROUND: Player collides \n", this->getClassName() );
     328 
     329  Vector v = this->getAbsDirX();
     330  v.x *= 10;
     331  v.y *= 10;
     332  v.z *= 10;
     333  Vector u = this->getAbsDirY();
     334 
     335  if(feet.x == (u.x+this->getAbsCoor().x) &&  feet.y == u.y +this->getAbsCoor().y && feet.z == this->getAbsCoor().z)
     336  {
     337   
     338  this->setAbsCoor(ray_2 - v);
     339  }
     340  else
     341  {
     342    if(ray_1.x == this->getAbsCoor().x + v.x && ray_1.y == this->getAbsCoor().y + v.y + 0.1 && ray_1.z ==this->getAbsCoor().z + v.z)
     343    {
     344      this->setAbsCoor(feet -u ); 
     345    }
     346     
     347    this->setAbsCoor(ray_2 - v); 
     348   
     349  }
     350}
     351
     352/**
    314353 *  this is called immediately after the Entity has been constructed, initialized and then Spawned into the World
    315354 *
  • trunk/src/world_entities/world_entity.h

    r8037 r8186  
    6363  bool buildObbTree(int depth);
    6464  virtual void collidesWith (WorldEntity* entity, const Vector& location);
    65   /** @returns a reference to the obb tree of this worldentity */
     65  virtual void collidesWithGround(const Vector& location);
     66  virtual void collidesWithGround(const Vector& feet, const Vector& ray_1, const Vector& ray_2);
     67
     68
     69/** @returns a reference to the obb tree of this worldentity */
    6670  inline BVTree* getOBBTree() const { return this->obbTree; };
    6771  void drawBVTree(int depth, int drawMode) const;
Note: See TracChangeset for help on using the changeset viewer.