Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 24, 2007, 8:48:26 PM (17 years ago)
Author:
bottac
Message:

Here comes the updated version.

Location:
branches/ODE
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/ODE/src/lib/collision_reaction/cr_physics_full_walk.cc

    r10013 r10355  
    5353  {}
    5454
    55 
     55 
    5656  /**
    5757   * caluculates and applys the reaction to a specific collision
     
    6060  void CRPhysicsFullWalk::reactToCollision(Collision* collision)
    6161  {
     62        //PRINTF(0)("REACTION..................HEHEHEHEH:-)\n");
    6263
    6364    AABB* box = collision->getEntityA()->getModelAABB();
     
    6667    if( box == NULL)
    6768    {
    68       PRINTF(2)("this model has no aabb box so there is no correct collision reaction implemented. skipping\n");
     69      PRINTF(0)("this model has no aabb box so there is no correct collision reaction implemented. skipping\n");
    6970      return;
    7071    }
     
    9192      Vector collPos =  collision->getEntityA()->getAbsCoor()  + box->center - ce->getCollisionPosition();
    9293
     94
    9395      // test the 3 axis differently
    9496      switch( ce->getType())
     
    9698          /* collision in the X-AXIS */
    9799        case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_X:
    98           front = collPos.len() - box->halfLength[0];
     100               
     101        // PRINTF(0)("ZZZZZZZZZZ ZZZZZ\n");
     102          front = (collPos- entity->getAbsCoor()).len() - box->halfLength[0];
    99103
    100104          // object is beneath the plane (ground)
    101105          if( front <= 0.0f )
    102106          {
     107                // PRINTF(0)("FRONT");
    103108            Vector dirX = entity->getAbsDirX();
    104109            dirX.y = 0.0f;
     
    116121
    117122        case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_X_NEG:
     123       
     124        // PRINTF(0)("ZZZZZZZZZZ ZZZZZ\n");
    118125          back = collPos.len() - box->halfLength[0];
    119126
     
    121128          if( back <= 0.0f)
    122129          {
     130        //   PRINTF(0)("FRONT");
    123131            Vector dirX = entity->getAbsDirX();
    124132            dirX.y = 0.0f;
     
    136144
    137145
     146         
     147
     148
    138149          /* collision in the Y-AXIS */
    139150        case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Y_NEG:
    140151          // calulate the height above ground
    141           height = collPos.len() - box->halfLength[1];
    142 
    143 
     152          height =  height = collPos.dot(Vector(0.0,1.0,0.0))  - box->halfLength[1] ; // collPos.len()  - box->halfLength[1];
     153                // PRINTF(0)("HEIGHT : %f \n" , height);
     154       
    144155          // object is beneath the plane (ground)
    145156          //         if(height >= 0.0f && height <= 0.0001f) break ;// Do nothing
    146           if( height < 0.0f && -height < CR_MAX_WALK_HEIGHT)
    147           {
    148             entity->shiftCoor(Vector(0.0f, -height + 0.00001, 0.0f));
     157          if(height < 10.0f )//&& -height < CR_MAX_WALK_HEIGHT)
     158          {
     159               
     160           entity->shiftCoor(Vector(0.0f,-(height -10.0f)  + 0.0001, 0.0f));
     161        //entity->setVelocity(Vector(entity->getVelocity().x, entity->getVelocity().y,entity->getVelocity().z));
     162         //entity->setAbsCoor(Vector(entity->getAbsCoor().x, entity->getLastAbsCoor().y+ 100.0*(entity->getAbsCoor()-entity->getLastAbsCoor()).len(),entity->getAbsCoor().z) );
     163// PRINTF(0)("Geschw. %f\n",(0.0f));
     164// PRINTF(0)("ENTITY:. %s\n",entity->getCName());
     165
    149166            entity->setOnGround(true);
    150167          }
     
    153170          {
    154171            entity->setAbsCoor(entity->getLastAbsCoor());
    155             PRINTF(0)("ground collision: reset pos\n");
     172          //  PRINTF(0)("ground collision: reset pos\n");
    156173          }
    157174          else
     
    166183        case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Z:
    167184
     185         //PRINTF(0)("ZZZZZZZZZZ ZZZZZ\n");
    168186          right = collPos.len()  - box->halfLength[2];
    169187
     
    187205          // collision in the z-axis
    188206        case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Z_NEG:
    189 
     207         
     208        // PRINTF(0)("ZZZZZZZZZZ ZZZZZ\n");
    190209          left = collPos.len()  - box->halfLength[2];
    191210
Note: See TracChangeset for help on using the changeset viewer.