Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 4, 2006, 12:15:43 AM (18 years ago)
Author:
patrick
Message:

collision reaction for multiplayer works now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/presentation/src/lib/collision_reaction/cr_physics_ground_walk.cc

    r9065 r9076  
    209209
    210210
    211 #if 0
    212   if( box != NULL)
    213     height = ( ce->getCollisionPosition() - collision->getEntityB()->getAbsCoor() )*(-1.0f) ;
    214   else
    215     height = ce->getCollisionPosition() - collision->getEntityB()->getAbsCoor() ;
    216 
    217 
    218   if( box != NULL)
    219   {
    220 
    221 
    222     if(ce->getCollisionPosition().x <= 0.9 && ce->getGroundNormal().len() <= 1.4f)
    223     {
    224       collision->getEntityB()->setAbsCoor(collision->getEntityB()->getLastAbsCoor());
    225       return;
    226     }
    227     if(ce->getCollisionPosition().z <= 0.9 && ce->getGroundNormal().len() <= 1.4f)
    228     {
    229       collision->getEntityB()->setAbsCoor(collision->getEntityB()->getLastAbsCoor());
    230       return;
    231     }
    232 
    233     if(ce->getGroundNormal().len() <= 0.1f)
    234     {
    235       collision->getEntityB()->setAbsCoor(collision->getEntityB()->getLastAbsCoor());
    236       return;
    237     }
    238 
    239 
    240     if(ce->getGroundNormal().len() >= 1.4f)
    241     {
    242       downspeed++;
    243       collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() + Vector(0.0,-0.08*downspeed,0.0));
    244       return;
    245     }
    246 
    247 
    248     if(height.y > box->halfLength[1] + 0.0f ) // Above ground
    249     {
    250       if(height.y < box->halfLength[1] + 2.3f) // Snap in
    251       {
    252         downspeed = 0;
    253         collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() - Vector(0.0,height.y  - box->halfLength[1] - 0.0f,0.0));
    254       } else
    255       {
    256         downspeed++;
    257         collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() + Vector(0.0,-0.08*downspeed,0.0));
    258       }
    259 
    260     }
    261     else
    262     {
    263       if(height.y <  box->halfLength[1] + 0.0f   /* && height.y  >  - 55.0f*/) // below ground
    264       {
    265         //if(downspeed <= 0) downspeed =1;
    266         collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() + Vector(0.0, -height.y  +  box->halfLength[1] + 2.0f,0.0));
    267         //collision->getEntityB()->setVelocity(Vector(0.0,0.0,0.0));
    268         downspeed = 0;
    269       }
    270 
    271     }
    272 
    273   }// if(box!= NULL)
    274 #endif
    275   /*
    276   PRINTF(0)("Collision with Ground: \n");
    277   collision->getEntityB()->getAbsCoor().debug();
    278   collision->getEntityB()->setVelocity(Vector());
    279   collision->getEntityB()->setAbsCoor(this->lastPositions[1]);
    280 
    281   */
    282211
    283212}
Note: See TracChangeset for help on using the changeset viewer.