Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9235 in orxonox.OLD for trunk/src/lib/collision_reaction


Ignore:
Timestamp:
Jul 5, 2006, 4:39:02 PM (18 years ago)
Author:
bensch
Message:

merged the presentation back

Location:
trunk/src/lib/collision_reaction
Files:
5 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/collision_reaction/Makefile.am

    r8490 r9235  
    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
  • trunk/src/lib/collision_reaction/collision_handle.cc

    r8724 r9235  
    2525#include "cr_object_damage.h"
    2626#include "cr_physics_ground_walk.h"
     27#include "cr_physics_full_walk.h"
    2728
    2829#include "debug.h"
     
    5253  switch( type)
    5354  {
    54     case CREngine::CR_PHYSICS_STEP_BACK:
    55 //       this->collisionReaction = new CRPhysicsGroundWalk();
     55    case CREngine::CR_PHYSICS_FULL_WALK:
     56      this->collisionReaction = new CRPhysicsFullWalk();
    5657      this->bContinuousPoll = true;
    5758      break;
     
    229230  for(; it < this->targetList.end(); it++)
    230231  {
     232//     if(collisionEvent->getEntityB()->isA(CL_AIMING_SYSTEM) || collisionEvent->getEntityA()->isA(CL_AIMING_SYSTEM))
     233//     {
     234//        PRINTF(0)("I am: %s colliding with: %s\n", owner->getClassName(), collisionEvent->getEntityB()->getClassName(), *it);
     235//        if( collisionEvent->getEntityA() == this->owner) {
     236//          PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassName(),
     237//          collisionEvent->getEntityB()->getClassName(), *it);
     238//          if( collisionEvent->getEntityB()->isA((ClassID)(*it))) {
     239//            PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(),
     240//            collisionEvent->getEntityB()->getClassName(), *it);
     241//             }
     242//        }
     243//        else {
     244//          PRINTF(0)("I am not owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassName(),
     245//          collisionEvent->getEntityB()->getClassName(), *it);
     246//          if( collisionEvent->getEntityA()->isA((ClassID)(*it))) {
     247//            PRINTF(0)("I'm not owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(),
     248//            collisionEvent->getEntityA()->getClassName(), *it);
     249//             }
     250//        }
     251//
     252//     }
     253
    231254    if( collisionEvent->getEntityA() == this->owner) {
    232255      if( collisionEvent->getEntityB()->isA((ClassID)(*it))) {
     
    256279  for(; it < this->targetList.end(); it++)
    257280  {
     281
     282//     if(collision->getEntityB()->isA(CL_AIMING_SYSTEM) || collision->getEntityA()->isA(CL_AIMING_SYSTEM))
     283//     {
     284//       PRINTF(0)("Shared!!! I am: %s colliding with: %s\n", owner->getClassName(), collision->getEntityB()->getClassName(), *it);
     285//       if( collision->getEntityA() == this->owner) {
     286//         PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassName(),
     287//         collision->getEntityB()->getClassName(), *it);
     288//         if( collision->getEntityB()->isA((ClassID)(*it))) {
     289//           PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(),
     290//           collision->getEntityB()->getClassName(), *it);
     291//         }
     292//       }
     293//       else {
     294//         PRINTF(0)("I'm not owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassName(),
     295//         collision->getEntityB()->getClassName(), *it);
     296//         if( collision->getEntityA()->isA((ClassID)(*it))) {
     297//           PRINTF(0)("I'm not owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(),
     298//           collision->getEntityA()->getClassName(), *it);
     299//         }
     300//       }
     301//     }
     302
    258303    if( collision->getEntityA() == this->owner) {
    259304      if( collision->getEntityA()->isA((ClassID)(*it)))
  • trunk/src/lib/collision_reaction/cr_engine.h

    r8190 r9235  
    3030    CR_PHYSICS_MOMENTUM   = 0,    //!< physical reaction: conservervation of momentum
    3131    CR_PHYSICS_STEP_BACK,         //!< physical reaction: just go to the last position without collisions
    32     CR_PHYSICS_GROUND,            //!< physical reaction: stand on the ground, no movement: simulating simple normal force away from the gravity force
    33     CR_PHYSICS_GROUND_WALK,       //!< physical reaction: walking on the ground (inkl. hills etc)
     32    CR_PHYSICS_GROUND_WALK,       //!< physical reaction: stand on the ground, no movement: simulating simple normal force away from the gravity force
     33    CR_PHYSICS_FULL_WALK,         //!< physical reaction: walking on the ground (inkl. hills etc)
    3434    CR_PHYSICS_DAMAGE,            //!< physical reaction: daling damage according to the object energy and their structural stability
    3535
  • trunk/src/lib/collision_reaction/cr_object_damage.cc

    r9061 r9235  
    5656  float damage = 0.0f;
    5757
    58   PRINTF(0)("Dealing damage - Handling collision: %s vs %s\n",
     58  PRINTF(4)("Dealing damage - Handling collision: %s vs %s\n",
    5959            collision->getEntityA()->getClassName(),
    6060            collision->getEntityB()->getClassName());
  • trunk/src/lib/collision_reaction/cr_physics_ground_walk.cc

    r9110 r9235  
    7171
    7272  float CR_MAX_WALK_HEIGHT = 15.0f;
    73   float CR_THRESHOLD = 0.2f;
    7473
    7574  float height = 0.0f;
    76   float front = 0.0f;
    77   float back = 0.0f;
    78   float right = 0.0f;
    79   float left = 0.0f;
    8075
    8176
     
    9489    switch( ce->getType())
    9590    {
    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 
    13891        /* collision in the Y-AXIS */
    13992      case COLLISION_TYPE_AXIS_Y_NEG:
     
    153106        {
    154107          entity->setAbsCoor(entity->getLastAbsCoor());
    155           PRINTF(0)("ground collision: reset pos\n");
    156108        }
    157109        else
     
    163115
    164116
    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;
    207117    }
    208118  }
    209119  //PRINTF(0)("collision distances: x: %f, y: %f, z: %f\n", front, height, side);
    210 
    211 
    212 
    213 
    214 
    215 
    216120
    217121}
Note: See TracChangeset for help on using the changeset viewer.