Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8836 in orxonox.OLD for branches/single_player_map/src


Ignore:
Timestamp:
Jun 27, 2006, 5:08:43 PM (18 years ago)
Author:
patrick
Message:

spl: collision reaction similar as it was but doesn't stick to the ground yet

File:
1 edited

Legend:

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

    r8834 r8836  
    6666  //   collision->getEntityB()->getAbsCoor().debug();
    6767
    68   Vector height;
     68  float height;
    6969  AABB* box = collision->getEntityB()->getModelAABB();
     70  WorldEntity* entity = collision->getEntityB();
     71
     72  float CR_MAX_WALK_HEIGHT = 2.0f;
    7073
    7174  if( box != NULL)
     
    7376
    7477    Vector collPos =  collision->getEntityB()->getAbsCoor()  + box->center - ce->getCollisionPosition();
    75     PRINTF(0)("height: %f          , model height: %f\n", collPos.y, box->halfLength[1]);
     78    height = collPos.y - box->halfLength[1];
     79
     80    PRINTF(0)("height: %f          , model height: %f\n", height, box->halfLength[1]);
     81    PRINTF(0)(" ground normal: %f, %f, %f\n", normal.x, normal.y, normal.z);
     82
     83    // object is beneath the plane (ground)
     84    if( height < 0.0f)
     85    {
     86      entity->shiftCoor(Vector(0,-height,0));
     87    }
     88
    7689
    7790  }
     91
     92
     93
     94
    7895
    7996#if 0
     
    126143      {
    127144        //if(downspeed <= 0) downspeed =1;
    128         collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() + Vector(0.0, -height.y  +  box->halfLength[1] + 2.0f/* 0.00001 *//*height.y+3.500005 + 10.0*/,0.0));
     145        collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() + Vector(0.0, -height.y  +  box->halfLength[1] + 2.0f,0.0));
    129146        //collision->getEntityB()->setVelocity(Vector(0.0,0.0,0.0));
    130147        downspeed = 0;
Note: See TracChangeset for help on using the changeset viewer.