Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8091 in orxonox.OLD for branches


Ignore:
Timestamp:
Jun 1, 2006, 6:01:56 PM (19 years ago)
Author:
bensch
Message:

new version, with adapted world_entity

Location:
branches/bsp_model/src/world_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/bsp_model/src/world_entities/world_entity.cc

    r8037 r8091  
    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 *
  • branches/bsp_model/src/world_entities/world_entity.h

    r8037 r8091  
    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.