Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9123 in orxonox.OLD for branches


Ignore:
Timestamp:
Jul 4, 2006, 2:16:16 PM (18 years ago)
Author:
patrick
Message:

more collision reaction stuff

Location:
branches/presentation/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/presentation/src/defs/class_id.h

    r9061 r9123  
    276276  CL_COLLISION_REACTION         =    0X00000713,
    277277  CL_CR_PHYSICS_MOMENTUM        =    0X00000714,
    278   CL_CR_PHYSICS_GROUND          =    0X00000715,
    279   CL_CR_PHYSICS_GROUND_WALK     =    0X00000716,
     278  CL_CR_PHYSICS_GROUND_WALK     =    0X00000715,
     279  CL_CR_PHYSICS_FULL_WALK       =    0X00000716,
    280280  CL_CR_OBJECT_DAMAGE           =    0X00000717,
    281281  CL_CR_OBJECT_PICKUP           =    0X00000718,
  • branches/presentation/src/lib/collision_reaction/Makefile.am

    r8490 r9123  
    1010                     collision_reaction.cc \
    1111                     cr_object_damage.cc \
    12                      cr_physics_ground_walk.cc
     12                     cr_physics_ground_walk.cc \
     13                     cr_physics_full_walk.cc
    1314
    1415
     
    2122                     collision_reaction.h \
    2223                     cr_object_damage.h \
    23                      cr_physics_ground_walk.h
     24                     cr_physics_ground_walk.h \
     25                     cr_physics_full_walk.h
    2426
  • branches/presentation/src/lib/collision_reaction/cr_physics_ground_walk.cc

    r9110 r9123  
    7474
    7575  float height = 0.0f;
    76   float front = 0.0f;
    77   float back = 0.0f;
    78   float right = 0.0f;
    79   float left = 0.0f;
     76
    8077
    8178
     
    9491    switch( ce->getType())
    9592    {
    96         /* collision in the X-AXIS */
    97       case COLLISION_TYPE_AXIS_X:
    98         front = collPos.len() - box->halfLength[0];
    99 
    100         // object is beneath the plane (ground)
    101         if( front <= 0.0f )
    102         {
    103           Vector dirX = entity->getAbsDirX();
    104           dirX.y = 0.0f;
    105           dirX.normalize();
    106           Vector backoff = dirX * front;
    107 
    108           entity->shiftCoor(backoff);
    109         }
    110         else if( ce->isInWall())
    111         {
    112           // object is already in the wall
    113           entity->setAbsCoor(entity->getLastAbsCoor());
    114         }
    115         break;
    116 
    117       case COLLISION_TYPE_AXIS_X_NEG:
    118         back = collPos.len() - box->halfLength[0];
    119 
    120         // object is beneath the plane (ground)
    121         if( back <= 0.0f)
    122         {
    123           Vector dirX = entity->getAbsDirX();
    124           dirX.y = 0.0f;
    125           dirX.normalize();
    126           Vector backoff = dirX * back * -1.0f;
    127 
    128           entity->shiftCoor(backoff);
    129         }
    130         else if( ce->isInWall())
    131         {
    132           // object is already in the wall
    133           entity->setAbsCoor(entity->getLastAbsCoor());
    134         }
    135         break;
    136 
    137 
    13893        /* collision in the Y-AXIS */
    13994      case COLLISION_TYPE_AXIS_Y_NEG:
     
    153108        {
    154109          entity->setAbsCoor(entity->getLastAbsCoor());
    155           PRINTF(0)("ground collision: reset pos\n");
    156110        }
    157111        else
     
    163117
    164118
    165         /* collision in the Z-AXIS */
    166       case COLLISION_TYPE_AXIS_Z:
    167 
    168         right = collPos.len()  - box->halfLength[2];
    169 
    170         // object is beneath the plane (ground)
    171         if( right <= 0.0f )
    172         {
    173           Vector dirZ = entity->getAbsDirZ();
    174           dirZ.y = 0.0f;
    175           dirZ.normalize();
    176           Vector backoff = dirZ * right;
    177           entity->shiftCoor(backoff);
    178         }
    179         else if( ce->isInWall())
    180         {
    181           // object is already in the wall
    182           entity->setAbsCoor(entity->getLastAbsCoor());
    183         }
    184         break;
    185 
    186 
    187         // collision in the z-axis
    188       case COLLISION_TYPE_AXIS_Z_NEG:
    189 
    190         left = collPos.len()  - box->halfLength[2];
    191 
    192         // object is beneath the plane (ground)
    193         if( left <= 0.0f )
    194         {
    195           Vector dirZ = entity->getAbsDirZ();
    196           dirZ.y = 0.0f;
    197           dirZ.normalize();
    198           Vector backoff = dirZ * left*-1.0f;
    199           entity->shiftCoor(backoff);
    200         }
    201         // object is already in the wall
    202         else if( ce->isInWall())
    203         {
    204           entity->setAbsCoor(entity->getLastAbsCoor());
    205         }
    206         break;
    207119    }
    208120  }
    209121  //PRINTF(0)("collision distances: x: %f, y: %f, z: %f\n", front, height, side);
    210 
    211 
    212 
    213 
    214 
    215 
    216122
    217123}
  • branches/presentation/src/world_entities/creatures/fps_player.cc

    r9122 r9123  
    191191  this->getWeaponManager().getFixedTarget()->setParent(State::getCameraTargetNode());
    192192  this->getWeaponManager().getFixedTarget()->setRelCoor(0,0,0);
     193
    193194}
    194195
     
    208209{
    209210
    210   if( this->bPosBut)
    211   {
    212     this->bPosBut = false;
     211  if( this->bJump)
     212  {
    213213    printf("mechanic2:walkTo( %f, mtheight, %f)\n",this->getAbsCoorX(),this->getAbsCoorZ());
    214214  }
     
    373373  else if( event.type == KeyMapper::PEV_JUMP)
    374374    this->bJump = event.bPressed;
    375     this->bPosBut = event.bPressed;
    376375}
    377376
     
    379378{
    380379  Playable::respawn();
    381  
     380
    382381  AABB* box = this->getModelAABB();
    383382  if( box != NULL)
Note: See TracChangeset for help on using the changeset viewer.