Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9101 in orxonox.OLD


Ignore:
Timestamp:
Jul 4, 2006, 4:38:53 AM (18 years ago)
Author:
patrick
Message:

bigger fps player (right height from model), collision reaction refinement. still there is a possibility to go through walls because of interference in the cr system. not 1st prio but later on fixed

Location:
branches/presentation/src
Files:
2 edited

Legend:

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

    r9100 r9101  
    9494    switch( ce->getType())
    9595    {
    96       /* collision in the X-AXIS */
     96        /* collision in the X-AXIS */
    9797      case COLLISION_TYPE_AXIS_X:
    9898        front = collPos.len() - box->halfLength[0];
     
    101101        if( front <= 0.0f )
    102102        {
    103           Vector dirX = entity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize();
     103          Vector dirX = entity->getAbsDirX();
     104          dirX.y = 0.0f;
     105          dirX.normalize();
    104106          Vector backoff = dirX * front;
    105107
    106           //entity->setAbsCoor(entity->getLastAbsCoor());
    107           entity->shiftCoor(backoff);
    108         }
    109         // object is already in the wall
    110         else if( ce->isInWall())
    111         {
    112               entity->setAbsCoor(entity->getLastAbsCoor());
     108          entity->shiftCoor(backoff);
     109        }
     110        else if( ce->isInWall())
     111        {
     112          // object is already in the wall
     113          entity->setAbsCoor(entity->getLastAbsCoor());
    113114        }
    114115        break;
     
    122123        if( back <= 0.0f)
    123124        {
    124           Vector dirX = entity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize();
     125          Vector dirX = entity->getAbsDirX();
     126          dirX.y = 0.0f;
     127          dirX.normalize();
    125128          Vector backoff = dirX * back * -1.0f;
    126129
    127            //entity->setAbsCoor(entity->getLastAbsCoor());
    128            entity->shiftCoor(backoff);
    129         }
    130         // object is already in the wall
    131         else if( ce->isInWall())
    132         {
    133            entity->setAbsCoor(entity->getLastAbsCoor());
     130          entity->shiftCoor(backoff);
     131        }
     132        else if( ce->isInWall())
     133        {
     134          // object is already in the wall
     135          entity->setAbsCoor(entity->getLastAbsCoor());
    134136        }
    135137        break;
     
    143145
    144146        // object is beneath the plane (ground)
    145 //         if(height >= 0.0f && height <= 0.0001f) break ;// Do nothing
     147        //         if(height >= 0.0f && height <= 0.0001f) break ;// Do nothing
    146148        if( height < 0.0f && -height < CR_MAX_WALK_HEIGHT)
    147149        {
     
    163165
    164166
     167        /* collision in the Z-AXIS */
     168      case COLLISION_TYPE_AXIS_Z:
     169
     170        right = collPos.len()  - box->halfLength[2];
     171
     172        // object is beneath the plane (ground)
     173        if( right <= 0.0f )
     174        {
     175          Vector dirZ = entity->getAbsDirZ();
     176          dirZ.y = 0.0f;
     177          dirZ.normalize();
     178          Vector backoff = dirZ * right;
     179          entity->shiftCoor(backoff);
     180        }
     181        else if( ce->isInWall())
     182        {
     183          // object is already in the wall
     184          entity->setAbsCoor(entity->getLastAbsCoor());
     185        }
     186        break;
     187
     188
    165189        // 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           entity->setAbsCoor(entity->getAbsCoor());
    174           Vector dirZ = entity->getAbsDirZ(); dirZ.y = 0.0f; dirZ.normalize();
    175           Vector backoff = dirZ * right;
    176           entity->shiftCoor(backoff);
    177         }
    178         // object is already in the wall
    179         else if( ce->isInWall())
    180         {
    181           entity->setAbsCoor(entity->getLastAbsCoor());
    182         }
    183         break;
    184 
    185 
    186          // collision in the z-axis
    187190      case COLLISION_TYPE_AXIS_Z_NEG:
    188191
     
    192195        if( left <= 0.0f )
    193196        {
    194           Vector dirZ = entity->getAbsDirZ(); dirZ.y = 0.0f; dirZ.normalize();
     197          Vector dirZ = entity->getAbsDirZ();
     198          dirZ.y = 0.0f;
     199          dirZ.normalize();
    195200          Vector backoff = dirZ * left*-1.0f;
    196201          entity->shiftCoor(backoff);
  • branches/presentation/src/world_entities/creatures/fps_player.cc

    r9085 r9101  
    2727#include "weapons/cannon.h"
    2828#include "weapons/fps_sniper_rifle.h"
     29
     30#include "aabb.h"
    2931
    3032#include "key_mapper.h"
     
    124126
    125127  this->getWeaponManager().setSlotCount(2);
    126   this->getWeaponManager().setSlotPosition(0, Vector(1.5, -0.7, 1.1));
    127128//   this->getWeaponManager().setSlotDirection(0, Quaternion(M_PI_2, Vector(0,1,0)));
    128129  this->getWeaponManager().setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    129   this->getWeaponManager().setSlotPosition(1, Vector(5.0, 0.0, 0.0));
    130130  this->getWeaponManager().setSlotDirection(1, Quaternion(M_PI_4*.5, Vector(1,0,0)));
     131
     132
     133  AABB* box = this->getModelAABB();
     134  if( box != NULL)
     135  {
     136    this->getWeaponManager().setSlotPosition(0, Vector(1.5, box->halfLength[1] * 2.0f - 0.7, 1.1));
     137    this->getWeaponManager().setSlotPosition(1, Vector(5.0, box->halfLength[1] * 2.0f, 0.0));
     138  }
     139  else
     140  {
     141    this->getWeaponManager().setSlotPosition(0, Vector(1.5, -0.7, 1.1));
     142    this->getWeaponManager().setSlotPosition(1, Vector(5.0, 0.0, 0.0));
     143  }
     144
    131145
    132146  this->getWeaponManager().setParentNode(&this->cameraNode);
     
    191205
    192206
    193   State::getCameraNode()->setRelCoor(0,0,0);
    194   State::getCameraTargetNode()->setRelCoor(10,0,0);
     207  AABB* box = this->getModelAABB();
     208  if( box != NULL)
     209  {
     210    State::getCameraNode()->setRelCoor(0, box->halfLength[1] * 2.0f, 0);
     211    State::getCameraTargetNode()->setRelCoor(10, box->halfLength[1] * 2.0f, 0);
     212  }
    195213}
    196214
     
    209227void FPSPlayer::tick (float time)
    210228{
    211  
     229
    212230  if( this->bPosBut)
    213231  {
     
    215233    printf("mechanic:walkTo( %f, mheight, %f)\n",this->getAbsCoorX(),this->getAbsCoorZ());
    216234  }
    217  
     235
    218236  Playable::tick( time );
    219237
Note: See TracChangeset for help on using the changeset viewer.