Changeset 8864 in orxonox.OLD for branches/single_player_map/src/lib/collision_reaction
- Timestamp:
- Jun 28, 2006, 3:51:36 PM (19 years ago)
- Location:
- branches/single_player_map/src/lib/collision_reaction
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/single_player_map/src/lib/collision_reaction/collision_event.h
r8862 r8864 9 9 #include "vector.h" 10 10 11 #include "cr_defs.h" 12 13 11 14 class WorldEntity; 12 15 class BoundingVolume; 13 16 class Plane; 17 14 18 15 19 … … 22 26 23 27 /** collides two WorldEntities @param entityA world entity A, @param entityB world entity B, @param bvA volume A @param bvB volumeB */ 24 inline void collide( WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB)25 { this-> entityA = entityA; this->entityB = entityB; this->bvA = bvA; this->bvB = bvB; }28 inline void collide(int type, WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB) 29 { this->collisionType = type; this->entityA = entityA; this->entityB = entityB; this->bvA = bvA; this->bvB = bvB; } 26 30 /** collides two WorldEntities @param entity world entity , @param ground ground plane, @param position position on the ground */ 27 inline void collide( WorldEntity* entity, WorldEntity* groundEntity, Vector normal, Vector position, bool bInWall)28 { this-> entityA = entity; this->entityB = groundEntity, this->groundNormal = normal; this->position = position; this->bInWall = bInWall; }31 inline void collide(int type, WorldEntity* entity, WorldEntity* groundEntity, Vector normal, Vector position, bool bInWall) 32 { this->collisionType = type; this->entityA = entity; this->entityB = groundEntity, this->groundNormal = normal; this->position = position; this->bInWall = bInWall; } 29 33 30 34 … … 44 48 inline Vector getCollisionPosition() { return this->position; } 45 49 50 /** @return the type of the collision */ 51 inline int getType() { return this->collisionType; } 52 46 53 /** @return true if the entity is in the wall */ 47 54 inline bool isInWall() { return this->bInWall; } … … 59 66 60 67 bool bInWall; //!< true if is in wall 68 int collisionType; //!< collision type 61 69 }; 62 70 -
branches/single_player_map/src/lib/collision_reaction/cr_defs.h
r8190 r8864 28 28 29 29 30 //!< the collision axis x collision event 31 #define COLLISION_TYPE_AXIS_X 1 32 //!< the collision axis y collision event 33 #define COLLISION_TYPE_AXIS_Y 2 34 //!< the collision axis z collision event 35 #define COLLISION_TYPE_AXIS_Z 4 36 //!< the collision is a obb collision 37 #define COLLISION_TYPE_OBB 8 38 30 39 31 40 #endif /* _NETWORK_MANAGER */ -
branches/single_player_map/src/lib/collision_reaction/cr_physics_ground_walk.cc
r8863 r8864 66 66 // collision->getEntityB()->getAbsCoor().debug(); 67 67 68 Vectorheight;68 float height; 69 69 AABB* box = collision->getEntityB()->getModelAABB(); 70 70 WorldEntity* entity = collision->getEntityB(); … … 73 73 float CR_THRESHOLD = 0.2f; 74 74 75 //if( box != NULL)76 //{77 // 78 //Vector collPos = collision->getEntityB()->getAbsCoor() + box->center - ce->getCollisionPosition();79 //height = collPos.y - box->halfLength[1];80 // 81 //PRINTF(0)("height: %f , model height: %f\n", height, box->halfLength[1]);82 //PRINTF(0)(" ground normal: %f, %f, %f\n", normal.x, normal.y, normal.z);83 // 84 //// object is beneath the plane (ground)85 //if( height < 0.0f )86 //{87 //entity->shiftCoor(Vector(0, -height, 0));88 //}89 //// object is already in the wall90 //else if( ce->isInWall())91 //{92 // 93 //}94 // 95 // 96 // 97 //}75 if( box != NULL) 76 { 77 78 Vector collPos = collision->getEntityB()->getAbsCoor() + box->center - ce->getCollisionPosition(); 79 height = collPos.y - box->halfLength[1]; 80 81 PRINTF(0)("height: %f , model height: %f\n", height, box->halfLength[1]); 82 PRINTF(0)(" ground normal: %f, %f, %f\n", normal.x, normal.y, normal.z); 83 84 // object is beneath the plane (ground) 85 if( height < 0.0f ) 86 { 87 entity->shiftCoor(Vector(0, -height, 0)); 88 } 89 // object is already in the wall 90 else if( ce->isInWall()) 91 { 92 entity->setAbsCoor(entity->getLastAbsCoor()); 93 } 94 95 96 97 } 98 98 99 99 … … 101 101 102 102 103 //#if 0103 #if 0 104 104 if( box != NULL) 105 105 height = ( ce->getCollisionPosition() - collision->getEntityB()->getAbsCoor() )*(-1.0f) ; … … 158 158 159 159 }// if(box!= NULL) 160 //#endif160 #endif 161 161 /* 162 162 PRINTF(0)("Collision with Ground: \n");
Note: See TracChangeset
for help on using the changeset viewer.