Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 28, 2006, 3:51:36 PM (18 years ago)
Author:
patrick
Message:

new collision registration functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/single_player_map/src/lib/graphics/importer/bsp_manager.cc

    r8796 r8864  
    11/*
    22   orxonox - the future of 3D-vertical-scrollers
    3  
     3
    44   Copyright (C) 2006 orx
    5  
     5
    66   This program is free software; you can redistribute it and/or modify
    77   it under the terms of the GNU General Public License as published by
    88   the Free Software Foundation; either version 2, or (at your option)
    99   any later version.
    10  
     10
    1111   ### File Specific:
    1212   main-programmer: bottac@ee.ethz.ch
    13  
     13
    1414   Inspired by:
    1515   Rendering Q3 Maps by Morgan McGuire                  http://graphics.cs.brown.edu/games/quake/quake3.html
    1616   Unofficial Quake 3 Map Specs by Kekoa Proudfoot      http://graphics.stanford.edu/~kekoa/q3/
    17  
     17
    1818   Collision detection adapted from:
    1919   Quake 3 Collision Detection by Nathan Ostgard        http://www.devmaster.net/articles/quake3collision/
     
    4545
    4646#include "aabb.h"
    47 
     47#include "cr_defs.h"
    4848
    4949
     
    6969BspManager::BspManager(const TiXmlElement* root)
    7070{
    71  
    72  
     71
     72
    7373  if( root != NULL)
    7474    this->loadParams(root);
    75  
     75
    7676  CDEngine::getInstance()->setBSPModel(this);
    7777} */
     
    9999  this->root  = this->bspFile->get_root();
    100100  this->alreadyVisible = new bool [this->bspFile->numFaces];
    101  
     101
    102102  CDEngine::getInstance()->setBSPModel(this);
    103103}
     
    962962  upDir.z = 0.0;
    963963  Vector dest;
    964    
     964
    965965
    966966  Vector position = worldEntity->getAbsCoor();       //+ upDir*10.0f ;
     
    978978  Vector out2;
    979979
    980  
     980
    981981
    982982  float height = 40;
    983  
    984  
     983
     984
    985985  if( box != NULL)
    986986  {
    987987    position = worldEntity->getAbsCoor() +  box->center; // + box->axis[1] * box->halfLength[1];
    988988    dest     = worldEntity->getAbsCoor() +  box->center - box->axis[1] * box->halfLength[1] * 40.0;
    989    
     989
    990990    position1 = worldEntity->getAbsCoor() +  box->center + box->axis[0] * box->halfLength[0] * 2.0f;
    991991    dest1     = worldEntity->getAbsCoor() +  box->center - box->axis[0] * box->halfLength[0] *2.0f;
    992    
    993        
     992
     993
    994994    position2 = worldEntity->getAbsCoor() +  box->center + box->axis[2] * box->halfLength[2] * 2.0f;
    995995    dest2     = worldEntity->getAbsCoor() +  box->center - box->axis[2] * box->halfLength[2] * 2.0f;
    996    
     996
    997997  }
    998998  else
    999999  {
    1000    
    1001   }
    1002 
    1003  
    1004  
     1000
     1001  }
     1002
     1003
     1004
    10051005  //
    10061006  this->inputStart =  position;
     
    10251025        this->collPlane->z = 0.0f;
    10261026        collision = true;
    1027       } else 
     1027      } else
    10281028        collision = false;
    1029        
    1030        
     1029
     1030
    10311031        out = dest;
    1032      
     1032
    10331033    } else {
    10341034      collision = true;
     
    10461046  plane* testPlane = this->collPlane;
    10471047
    1048  
     1048
    10491049  // 2nd Collision Detection
    10501050  this->outputStartsOut = true;
     
    10561056  out.x = this->outputFraction;
    10571057  //out.z = this->outputFraction;
    1058  
    1059  
     1058
     1059
    10601060    // 3rd Collision Detection
    10611061  this->outputStartsOut = true;
     
    10671067  //out.x = this->outputFraction;
    10681068  out.z = this->outputFraction;
    1069  
     1069
    10701070
    10711071  /*
     
    10771077
    10781078  // Return the normal here: Normal's stored in this->collPlane;
    1079   if( collision) 
     1079  if( collision)
    10801080  {
    10811081    PRINTF(5)("We got a collision!! Are you sure: outputFraction = %f\n", this->outputFraction);
    1082     worldEntity->registerCollision(this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out);
    1083   } 
    1084   else  worldEntity->registerCollision(this->parent, worldEntity, Vector(0.0, 2.0, 0.0), dest);
     1082    worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y, this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out);
     1083  }
     1084  else  worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y, this->parent, worldEntity, Vector(0.0, 2.0, 0.0), dest);
    10851085
    10861086}
Note: See TracChangeset for help on using the changeset viewer.