Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 8, 2006, 3:47:40 PM (18 years ago)
Author:
patrick
Message:

bsp: some cr default values rearangements

Location:
branches/bsp_model/src/lib/collision_reaction
Files:
6 edited

Legend:

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

    r8203 r8256  
    2727
    2828    /** collides two WorldEntities @param entityA world entity A, @param entityB world entity B, @param bvA volume A @param bvB volumeB */
    29     inline void collide(WorldEntity* entityA, WorldEntity* entityB) { this->entityA = entityA; this->entityB = entityB; }
     29    inline void collide(WorldEntity* entityA, WorldEntity* entityB) { this->entityA = entityA; this->entityB = entityB; this->bDispatched = false; }
    3030
    3131
  • branches/bsp_model/src/lib/collision_reaction/collision_handle.cc

    r8220 r8256  
    4141
    4242  this->bCollided = false;
    43   this->bDispatched = false;
     43  this->bDispatched = true;
    4444
    4545  this->collisionReaction = NULL;
    46   this->bContinuousPoll = true;
     46  this->bContinuousPoll = false;
    4747  this->bStopOnFirstCollision = false;
    4848
     
    5656    case CREngine::CR_PHYSICS_GROUND_WALK:
    5757      this->collisionReaction = new CRPhysicsGroundWalk();
     58      this->bContinuousPoll = true;
    5859      break;
    5960    case CREngine::CR_OBJECT_DAMAGE:
     
    191192void CollisionHandle::handleCollisions()
    192193{
     194//   if( this->type == CREngine::CR_)
     195
    193196  // collision reaction calculations (for every collision there will be a reaction)
    194197  vector<Collision*>::iterator it = this->collisionList.begin();
     
    205208  this->bCollided = false;
    206209
     210  // if continuous poll poll the reaction
     211   if( this->bContinuousPoll)
     212     this->collisionReaction->update(this->owner);
    207213  this->flushCollisions();
    208214}
     
    215221bool CollisionHandle::filterCollisionEvent(CollisionEvent* collisionEvent)
    216222{
     223  if( this->type == CREngine::CR_PHYSICS_GROUND_WALK)
     224  {
     225
     226    vector<long>::iterator it = this->targetList.begin();
     227    for(; it < this->targetList.end(); it++)
     228    {
     229      PRINTF(0)("filtering: %i vs EntityA %i, EntityB %i \n", *it, collisionEvent->getEntityA()->getClassID(), collisionEvent->getEntityB()->getClassID());
     230
     231    }
     232  }
     233
    217234  vector<long>::iterator it = this->targetList.begin();
    218235  for(; it < this->targetList.end(); it++)
  • branches/bsp_model/src/lib/collision_reaction/collision_reaction.h

    r8190 r8256  
    1212
    1313class Collision;
     14class WorldEntity;
     15
    1416
    1517//! A class representing a simple collision
     
    2325    virtual void reactToCollision(Collision* collision) = 0;
    2426
     27    virtual void update(WorldEntity* owner) {}
     28
     29    /** use this to do some collision offline calculations, only called for bContinuousPoll == true */
    2530    inline bool isContinuousPoll() const { return this->bContinuousPoll; }
    2631
  • branches/bsp_model/src/lib/collision_reaction/cr_engine.cc

    r8234 r8256  
    143143  for( it = this->collisionHandles.begin(); it != this->collisionHandles.end(); it++)
    144144  {
    145     if( (*it)->isCollided() || (*it)->isContinuousPoll())  //does it have any collisions to report at all
     145    if( !(*it)->isDispatched() || (*it)->isContinuousPoll())  //does it have any collisions to report at all
    146146    {
    147       PRINTF(0)("CREngine: handle %i\n", (*it)->getType());
    148147      (*it)->handleCollisions();
    149148    }
  • branches/bsp_model/src/lib/collision_reaction/cr_physics_ground_walk.cc

    r8234 r8256  
    3434{
    3535  this->setClassID(CL_CR_PHYSICS_GROUND_WALK, "CRPhysicsGroundWalk");
    36 
    3736}
    3837
     
    5453//   Vector normal = collision
    5554  PRINTF(0)("Ground\n");
     55}
     56
     57
     58
     59/**
     60 * use this to do some collision offline calculations, only called for bContinuousPoll == true
     61 */
     62void CRPhysicsGroundWalk::update(WorldEntity* owner)
     63{
     64  this->lastPosition = owner->getAbsCoor();
     65  this->lastDirection = owner->getAbsDir();
     66
    5667
    5768}
    5869
     70
  • branches/bsp_model/src/lib/collision_reaction/cr_physics_ground_walk.h

    r8221 r8256  
    2121    virtual void reactToCollision(Collision* collision);
    2222
     23    virtual void update(WorldEntity* entity);
     24
    2325  private:
    2426    Vector       lastPosition;                //!< vector with the last valid position
    25     Quaternion   lastDireciton;               //!< quat with the last valid direction
     27    Quaternion   lastDirection;               //!< quat with the last valid direction
    2628};
    2729
Note: See TracChangeset for help on using the changeset viewer.