Changeset 8029 in orxonox.OLD for branches/cr
- Timestamp:
- May 31, 2006, 3:18:19 PM (19 years ago)
- Location:
- branches/cr/src/lib/collision_reaction
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/cr/src/lib/collision_reaction/collision.h
r8006 r8029 31 31 inline WorldEntity* getEntityB() const { return this->entityB; } 32 32 33 /** @returns true if this Collision has already been dispatched */ 34 inline bool isDispatched() { return this->bDispatched; } 35 33 36 /** registers a @param event CollisionEvent to take place */ 34 37 inline void registerCollisionEvent(CollisionEvent* event) { this->collisionEvents.push_back(event); } … … 47 50 WorldEntity* entityB; //!< the collision body B 48 51 52 bool bDispatched; //!< true if this collision has already been dispatched 53 49 54 std::vector<CollisionEvent*> collisionEvents; //!< the collision event list 50 55 }; -
branches/cr/src/lib/collision_reaction/collision_handle.cc
r7999 r8029 100 100 void CollisionHandle::registerCollisionEvent(CollisionEvent* collisionEvent) 101 101 { 102 // set the state to not dispatched 103 this->bDispatched = false; 104 102 105 // first element only 103 106 Collision* c = this->registerCollision(collisionEvent->getEntityA(), collisionEvent->getEntityB()); -
branches/cr/src/lib/collision_reaction/collision_handle.h
r7989 r8029 32 32 Collision* registerCollision(WorldEntity* entityA, WorldEntity* entityB); 33 33 void registerCollisionEvent(CollisionEvent* collisionEvent); 34 34 35 /** @returns true if regiestered some new collision events in this tick frame */ 35 36 inline bool isCollided() const { return this->bCollided; } 37 /** @returns true if this collision handle has already been dispatched */ 38 inline bool isDispatched() const { return this->bDispatched; } 36 39 37 40 void handleCollisions(); -
branches/cr/src/lib/collision_reaction/collision_reaction.h
r8006 r8029 23 23 virtual void reactToCollision(Collision* collision) = 0; 24 24 25 inline bool isContinuousPoll() const { return this->bContinuousPoll; } 26 25 27 private: 26 28 bool bContinuousPoll; //!< if true the collision rection function is also called, if there was no collision 27 29 }; 28 30 -
branches/cr/src/lib/collision_reaction/cr_engine.cc
r8000 r8029 145 145 for( it = this->collisionHandles.begin(); it != this->collisionHandles.end(); it++) 146 146 { 147 if( (*it)->isCollided()) 147 if( (*it)->isCollided()) //does it have any collisions to report at all 148 148 { 149 149 (*it)->handleCollisions(); -
branches/cr/src/lib/collision_reaction/cr_engine.h
r7966 r8029 28 28 public: 29 29 typedef enum CRType { 30 CR_PHYSICS_MOMENTUM = 0, 31 CR_PHYSICS_GROUND, 32 CR_PHYSICS_GROUND_WALK, 30 CR_PHYSICS_MOMENTUM = 0, //!< physical reaction: conservervation of momentum 31 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) 34 CR_PHYSICS_DAMAGE, //!< physical reaction: daling damage according to the object energy and their structural stability 33 35 34 CR_OBJECT_DAMAGE, 35 CR_OBJECT_PICKUP, 36 CR_OBJECT_DAMAGE, //!< object raction: deals damage according to the objects specific damage potential (like weapons, nukes, etc.) 37 CR_OBJECT_PICKUP, //!< object rection: calling the objects pickup functions, let them handle the collision (once!) 36 38 37 CR_VERTEX_TRAFO, 39 CR_VERTEX_TRAFO, //!< vertex trafo: transforming the vertex according to the damage 38 40 39 CR_SPECIAL_CALLBACK, 41 CR_SPECIAL_CALLBACK, //!< special: call a callback function 40 42 41 43 CR_NUMBER -
branches/cr/src/lib/collision_reaction/cr_object_damage.cc
r8006 r8029 50 50 { 51 51 52 const std::vector<CollisionEvent*>* v = &collision->getCollisionEvents();53 const std::vector<CollisionEvent*>::const_iterator it = v->begin();54 for(; it < v->end(); it++)52 const std::vector<CollisionEvent*>* collisionEvents = &(collision->getCollisionEvents()); 53 std::vector<CollisionEvent*>::const_iterator it = collisionEvents->begin(); 54 for(; it != collisionEvents->end(); it++) 55 55 { 56 56 // go through the collisions and try to estimate the damage
Note: See TracChangeset
for help on using the changeset viewer.