Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8216 in orxonox.OLD for branches/bsp_model


Ignore:
Timestamp:
Jun 7, 2006, 9:33:10 PM (18 years ago)
Author:
patrick
Message:

bsp: collision registering should now work

Location:
branches/bsp_model/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/bsp_model/src/lib/collision_reaction/collision_event.h

    r8203 r8216  
    2525  { this->entityA = entityA; this->entityB = entityB; this->bvA = bvA; this->bvB = bvB; }
    2626  /** collides two WorldEntities @param entity world entity , @param ground ground plane, @param position position on the ground */
    27   inline void collide(WorldEntity* entity, Plane* ground, Vector position)
    28   { this->entityA = entity; this->ground = ground; this->position = position; }
     27  inline void collide(WorldEntity* entity, Vector normal, Vector position)
     28  { this->entityA = entity; this->groundNormal = normal; this->position = position; }
    2929
    3030
     
    3939
    4040  /** @return ground plane if collided with bsp model */
    41   inline Plane* getGroundPlane() { return this->ground; }
    42 
    43 
    44 
    45   inline void operator()(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB) { this->collide(entityA, entityB, bvA, bvB); }
    46   inline void operator()(WorldEntity* entity, Plane* ground, Vector position) { this->collide(entity, ground, position); }
     41  inline Vector getGroundNormal() { return this->groundNormal; }
    4742
    4843
     
    5449  BoundingVolume*   bvB;                           //!< reference to the bounding volume B
    5550
    56   Plane*            ground;                        //!< the ground plane with which it collides (only for bsp-model collisions
     51  Vector            groundNormal;                  //!< the ground plane with which it collides (only for bsp-model collisions
    5752  Vector            position;                      //!< position of the collision on the ground plane
    5853};
  • branches/bsp_model/src/lib/collision_reaction/cr_object_damage.cc

    r8190 r8216  
    5252void CRObjectDamage::reactToCollision(Collision* collision)
    5353{
    54   float damage;
     54  float damage = 0.0f;
    5555
    5656  PRINTF(0)("Dealing damage - Handling collision: %s vs %s\n",
  • branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc

    r8215 r8216  
    874874
    875875
    876 
    877 
    878 
    879 
    880 
    881 
    882876  if(!worldEntity->isA(CL_PLAYABLE)) {
    883877
     
    937931    // Return the normal here: Normal's stored in this->collPlane;
    938932
    939     if(collision) worldEntity->collidesWithGround(out,out1,out2);
    940 //     registerCollision(WorldEntity* entity, Vector(this->collPlane.x, ), Vector position);
    941 
    942   }
    943 
     933    if(collision)
     934      worldEntity->registerCollision(worldEntity, Vector(this->collPlane->x, this->collPlane->y, this->collPlane->z), out);
     935//       worldEntity->collidesWithGround(out,out1,out2);
     936  }
    944937}
    945938
  • branches/bsp_model/src/world_entities/world_entity.cc

    r8195 r8216  
    410410 *  @param position it collides on the plane
    411411 */
    412 bool WorldEntity::registerCollision(WorldEntity* entity, Plane* plane, Vector position)
     412bool WorldEntity::registerCollision(WorldEntity* entity, Vector normal, Vector position)
    413413{
    414414  // is there any handler listening?
     
    419419  CollisionEvent* c = CREngine::getInstance()->popCollisionEventObject();
    420420  assert(c != NULL); // if this should fail: we got not enough precached CollisionEvents: alter value in cr_defs.h
    421   c->collide(entity, plane, position);
     421  c->collide(entity, normal, position);
    422422
    423423  for( int i = 0; i < CREngine::CR_NUMBER; ++i)
     
    504504  Vector u = Vector(0.0,-20.0,0.0);
    505505
    506          
     506
    507507  if(!(this->getAbsCoor().x == ray_2.x && this->getAbsCoor().y == ray_2.y && this->getAbsCoor().z == ray_2.z) )
    508508  {
     
    521521
    522522  }
    523    
    524    
     523
     524
    525525}
    526526
  • branches/bsp_model/src/world_entities/world_entity.h

    r8190 r8216  
    2929class CollisionHandle;
    3030class Collision;
    31 class Plane;
    3231
    3332
     
    8685
    8786  bool registerCollision(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB);
    88   bool registerCollision(WorldEntity* entity, Plane* plane, Vector position);
     87  bool registerCollision(WorldEntity* entity, Vector normal, Vector position);
    8988  /** @return true if there is at least on collision reaction subscribed */
    9089  inline bool isReactive() const { return this->bReactive; }
Note: See TracChangeset for help on using the changeset viewer.