Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8029 in orxonox.OLD for branches/cr


Ignore:
Timestamp:
May 31, 2006, 3:18:19 PM (19 years ago)
Author:
patrick
Message:

cr: more collision, new interface

Location:
branches/cr/src/lib/collision_reaction
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/cr/src/lib/collision_reaction/collision.h

    r8006 r8029  
    3131    inline WorldEntity* getEntityB() const { return this->entityB; }
    3232
     33    /** @returns true if this Collision has already been dispatched */
     34    inline bool isDispatched() { return this->bDispatched; }
     35
    3336    /** registers a @param event CollisionEvent to take place */
    3437    inline void registerCollisionEvent(CollisionEvent* event) { this->collisionEvents.push_back(event); }
     
    4750    WorldEntity*                 entityB;                       //!< the collision body B
    4851
     52    bool                         bDispatched;                   //!< true if this collision has already been dispatched
     53
    4954    std::vector<CollisionEvent*> collisionEvents;               //!< the collision event list
    5055};
  • branches/cr/src/lib/collision_reaction/collision_handle.cc

    r7999 r8029  
    100100void CollisionHandle::registerCollisionEvent(CollisionEvent* collisionEvent)
    101101{
     102  // set the state to not dispatched
     103  this->bDispatched = false;
     104
    102105  // first element only
    103106 Collision* c = this->registerCollision(collisionEvent->getEntityA(), collisionEvent->getEntityB());
  • branches/cr/src/lib/collision_reaction/collision_handle.h

    r7989 r8029  
    3232    Collision* registerCollision(WorldEntity* entityA, WorldEntity* entityB);
    3333    void registerCollisionEvent(CollisionEvent* collisionEvent);
     34
    3435    /** @returns true if regiestered some new collision events in this tick frame */
    3536    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; }
    3639
    3740    void handleCollisions();
  • branches/cr/src/lib/collision_reaction/collision_reaction.h

    r8006 r8029  
    2323    virtual void reactToCollision(Collision* collision) = 0;
    2424
     25    inline bool isContinuousPoll() const { return this->bContinuousPoll; }
     26
    2527  private:
    26 
     28    bool                    bContinuousPoll;       //!< if true the collision rection function is also called, if there was no collision
    2729};
    2830
  • branches/cr/src/lib/collision_reaction/cr_engine.cc

    r8000 r8029  
    145145  for( it = this->collisionHandles.begin(); it != this->collisionHandles.end(); it++)
    146146  {
    147     if( (*it)->isCollided())
     147    if( (*it)->isCollided())  //does it have any collisions to report at all
    148148    {
    149149      (*it)->handleCollisions();
  • branches/cr/src/lib/collision_reaction/cr_engine.h

    r7966 r8029  
    2828  public:
    2929  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
    3335
    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!)
    3638
    37     CR_VERTEX_TRAFO,
     39    CR_VERTEX_TRAFO,              //!< vertex trafo: transforming the vertex according to the damage
    3840
    39     CR_SPECIAL_CALLBACK,
     41    CR_SPECIAL_CALLBACK,          //!< special: call a callback function
    4042
    4143    CR_NUMBER
  • branches/cr/src/lib/collision_reaction/cr_object_damage.cc

    r8006 r8029  
    5050{
    5151
    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++)
    5555  {
    5656    // go through the collisions and try to estimate the damage
Note: See TracChangeset for help on using the changeset viewer.