Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8490 in orxonox.OLD for trunk/src/world_entities/world_entity.cc


Ignore:
Timestamp:
Jun 15, 2006, 9:34:48 PM (18 years ago)
Author:
patrick
Message:

merged the bsp branche back to trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/world_entity.cc

    r8316 r8490  
    2121
    2222#include "model.h"
    23 #include "md2Model.h"
     23#include "md2/md2Model.h"
     24#include "md3/md3_model.h"
     25
    2426#include "util/loading/resource_manager.h"
    2527#include "util/loading/load_param.h"
     
    7779
    7880  // registering default reactions:
    79   this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, CL_WORLD_ENTITY);
    80   this->subscribeReaction(CREngine::CR_PHYSICS_GROUND, CL_TERRAIN);
     81//   this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, CL_WORLD_ENTITY);
    8182
    8283  this->toList(OM_NULL);
     
    200201        this->buildObbTree(obbTreeDepth);
    201202    }
     203    else if(fileName.find(".md3") != std::string::npos)
     204    {
     205      PRINTF(4)("fetching MD3 file: %s\n", fileName.c_str());
     206      Model* m = new md3::MD3Model(fileName, this->scaling);
     207      this->setModel(m, 0);
     208
     209//       if( m != NULL)
     210//         this->buildObbTree(obbTreeDepth);
     211    }
    202212  }
    203213  else
     
    411421 *  @param position it collides on the plane
    412422 */
    413 bool WorldEntity::registerCollision(WorldEntity* entity, Plane* plane, Vector position)
     423bool WorldEntity::registerCollision(WorldEntity* entity, WorldEntity* groundEntity, Vector normal, Vector position)
    414424{
    415425  // is there any handler listening?
     
    420430  CollisionEvent* c = CREngine::getInstance()->popCollisionEventObject();
    421431  assert(c != NULL); // if this should fail: we got not enough precached CollisionEvents: alter value in cr_defs.h
    422   c->collide(entity, plane, position);
     432  c->collide(entity, groundEntity, normal, position);
    423433
    424434  for( int i = 0; i < CREngine::CR_NUMBER; ++i)
     
    501511
    502512  Vector v = this->getAbsDirX();
    503   v.x *= 10;
    504   v.y *= 10;
    505   v.z *= 10;
    506   Vector u = this->getAbsDirY();
    507 
    508   if(feet.x == (u.x+this->getAbsCoor().x) &&  feet.y == u.y +this->getAbsCoor().y && feet.z == this->getAbsCoor().z)
     513  v.x *= 10.1;
     514  v.y *= 10.1;
     515  v.z *= 10.1;
     516  Vector u = Vector(0.0,-20.0,0.0);
     517
     518
     519  if(!(this->getAbsCoor().x == ray_2.x && this->getAbsCoor().y == ray_2.y && this->getAbsCoor().z == ray_2.z) )
    509520  {
    510521
    511522  this->setAbsCoor(ray_2 - v);
    512   }
    513   else
     523
     524  }
     525    else
    514526  {
    515527    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)
     
    521533
    522534  }
     535
     536
    523537}
    524538
Note: See TracChangeset for help on using the changeset viewer.