Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8699 in orxonox.OLD


Ignore:
Timestamp:
Jun 22, 2006, 2:32:46 AM (18 years ago)
Author:
patrick
Message:

bsp: the collision reaction now is adjusted to the object size

Location:
branches/bsp_model/src
Files:
3 edited

Legend:

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

    r8693 r8699  
    2323#include "world_entity.h"
    2424#include "cr_physics_ground_walk.h"
     25
     26#include "aabb.h"
     27
     28#include "debug.h"
    2529
    2630#include <vector>
     
    5660  Vector normal = ce->getGroundNormal();
    5761
     62  AABB* box = ce->getEntityB()->getModelAABB();
    5863
    59   Vector height = ce->getCollisionPosition() - collision->getEntityB()->getAbsCoor();
    60   if(ce->getGroundNormal().len() <= 0.1f)
     64  Vector center = ce->getEntityB()->getAbsCoor() /*+ box->center*/;
     65  Vector collisionPos = ce->getCollisionPosition() - center;
     66
     67  float objSize = box->halfLength[1];
     68
     69  if( normal.len() <= 0.1f)
    6170  {
    6271    collision->getEntityB()->setAbsCoor(collision->getEntityB()->getLastAbsCoor());
    6372    return;
    6473  }
    65   if(height.y < -3.6)
     74
     75  if( collisionPos.y <= -(objSize + 0.1f))
    6676  {
    6777    downspeed++;
    68     collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() + Vector(0.0,-0.03*downspeed,0.0));
    69 
     78    collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() + Vector(0.0, -0.03 * downspeed, 0.0));
    7079  }
    7180  else
    7281  {
    73     if(height.y > -3.5  && height.y <    3.9)
     82    if( collisionPos.y > -objSize  &&
     83        collisionPos.y < (objSize + 0.4))
    7484    {
    7585      //if(downspeed <= 0) downspeed =1;
    76       collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() + Vector(0.0,height.y+3.55,0.0));
    77       //collision->getEntityB()->setVelocity(Vector(0.0,0.0,0.0));
     86      collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() +
     87                                          Vector(0.0, collisionPos.y + objSize + 0.1, 0.0));
    7888    }
    7989      downspeed = 0;
     
    8191
    8292
    83   /*
    84   PRINTF(0)("Collision with Ground: \n");
    85   collision->getEntityB()->getAbsCoor().debug();
    86   collision->getEntityB()->setVelocity(Vector());
    87   collision->getEntityB()->setAbsCoor(this->lastPositions[1]);
    88 
    89   */
    9093}
    9194
  • branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc

    r8693 r8699  
    952952  Vector position;
    953953  Vector out;
     954  float height;
    954955
    955956  if( box != NULL)
     957  {
     958    forwardDir = worldEntity->getAbsDirX();
     959    forwardDir = forwardDir * box->halfLength[0];
     960
     961    upDir = Vector(0,1,0) * box->halfLength[1];
     962
     963    position = worldEntity->getAbsCoor() + box->center + box->axis[1] * box->halfLength[1];
     964    dest     = worldEntity->getAbsCoor() + box->center - box->axis[1] * box->halfLength[1];
     965    out      = dest;
     966
     967    height = box->halfLength[1];
     968  }
     969  else
    956970  {
    957971    forwardDir = worldEntity->getAbsDirX();
     
    964978    dest;
    965979
    966     position = worldEntity->getAbsCoor() + box->center + box->axis[1] * box->halfLength[1];
    967     dest     = worldEntity->getAbsCoor() + box->center - box->axis[1] * box->halfLength[1];
    968     out = dest;
    969 
    970   }
    971   else
    972   {
    973     forwardDir = worldEntity->getAbsDirX();
    974     forwardDir = forwardDir * 8.0f;
    975 
    976     upDir = worldEntity->getAbsDirY();
    977     upDir.x = 0.0;
    978     upDir.y = 1.0;
    979     upDir.z = 0.0;
    980     dest;
    981 
    982980    position = worldEntity->getAbsCoor() + upDir*5.0f;
    983981    dest = worldEntity->getAbsCoor() - upDir*40.0f; //
    984982    out = dest;
    985983
     984    height = 40;
    986985  }
    987986
     
    994993  Vector dest1 = position1 + forwardDir;
    995994  Vector dest2 = position2 + forwardDir;
    996   dest = position - Vector(0.0, 40.0,0.0);
     995//   dest = position - Vector(0.0, 40.0,0.0);
    997996  Vector out1;
    998997  Vector out2;
    999998
    1000999
    1001   float height = 40;
     1000
    10021001
    10031002  this->inputStart =  position;
  • branches/bsp_model/src/world_entities/creatures/fps_player.cc

    r8693 r8699  
    160160  Playable::tick( time );
    161161
    162   if( ( xMouse != 0 || yMouse != 0 ) && /*this->getOwner() == this->getHostID()*/ true)
     162  if( ( xMouse != 0 || yMouse != 0 ) /*&& this->getOwner() == this->getHostID() */)
    163163  {
    164164    xMouse *= time ;
     
    246246{
    247247  // only draw if this entity is not the player since the player nevers sees himself
    248 //   if( this->getCurrentPlayer() == NULL)
     248  if( this->getCurrentPlayer() == NULL)
    249249    WorldEntity::draw();
    250250}
Note: See TracChangeset for help on using the changeset viewer.