Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8106 in orxonox.OLD


Ignore:
Timestamp:
Jun 1, 2006, 10:27:53 PM (18 years ago)
Author:
patrick
Message:

cr: supporting now shared collision lists

Location:
branches/cr/src
Files:
6 edited

Legend:

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

    r8029 r8106  
    3030    /** @return Collision WorldEntity B */
    3131    inline WorldEntity* getEntityB() const { return this->entityB; }
     32    /** @return true if Entity A collides */
     33    inline bool isEntityACollide() { return this->entityACollide; }
     34    /** @return true if Entity B collides */
     35    inline bool isEntityBCollide() { return this->entityBCollide; }
    3236
    3337    /** @returns true if this Collision has already been dispatched */
     
    3842    /** @returns a vector of collision events */
    3943    inline const std::vector<CollisionEvent*>& getCollisionEvents() const { return this->collisionEvents; }
     44
     45
    4046
    4147    void handleCollisionEvents();
     
    4955    WorldEntity*                 entityA;                       //!< the collision body A
    5056    WorldEntity*                 entityB;                       //!< the collision body B
     57    bool                         entityACollide;                //!< true if entity A is subscribed for collision reaction
     58    bool                         entityBCollide;                //!< true if entity B is subscribed for collision reaction
    5159
    5260    bool                         bDispatched;                   //!< true if this collision has already been dispatched
  • branches/cr/src/lib/collision_reaction/collision_handle.cc

    r8099 r8106  
    1717#include "collision_handle.h"
    1818
     19#include "world_entity.h"
    1920
    2021#include "collision.h"
     
    9596  this->collisionList.push_back(c);
    9697
     98  // now register it as a shared collision with the other collision entity
     99  CollisionHandle* ch = entityB->getCollisionHandle(this->type);
     100  ch->registerSharedCollision(c);
     101
    97102  return c;
    98103}
     
    105110 * Therefore dispatching it only once
    106111 */
    107 void CollisionHandle::registerCollision(Collision* collision)
     112void CollisionHandle::registerSharedCollision(Collision* collision)
    108113{
     114  // set the state to not dispatched
     115  this->bDispatched = false;
    109116
     117  this->collisionList.push_back(collision);
    110118}
    111119
  • branches/cr/src/lib/collision_reaction/collision_handle.h

    r8099 r8106  
    3131    void addTarget(long target);
    3232    Collision* registerCollision(WorldEntity* entityA, WorldEntity* entityB);
    33     void registerCollision(Collision* collision);
     33    void registerSharedCollision(Collision* collision);
    3434    void registerCollisionEvent(CollisionEvent* collisionEvent);
    3535
  • branches/cr/src/lib/collision_reaction/cr_object_damage.cc

    r8049 r8106  
    5656  float velocity;
    5757
    58   PhysicsInterface* pi;
    5958
    60   const std::vector<CollisionEvent*>* collisionEvents = &(collision->getCollisionEvents());
    61   std::vector<CollisionEvent*>::const_iterator it = collisionEvents->begin();
    62   for(; it != collisionEvents->end(); it++)
    63   {
    64     pi = &(*it)->getEntityA()->getPhysicsInterface();
    65     // go through the collisions and try to estimate the damage
    66     mass = pi->getMass();
    67   }
     59
     60//   const std::vector<CollisionEvent*>* collisionEvents = &(collision->getCollisionEvents());
     61//   std::vector<CollisionEvent*>::const_iterator it = collisionEvents->begin();
     62//   for(; it != collisionEvents->end(); it++)
     63//   {
     64//     // go through the collisions and try to estimate the damage
     65//     mass = (*it)->getEntityA()->getMass();
     66//   }
    6867
    6968}
  • branches/cr/src/lib/physics/physics_interface.h

    r6616 r8106  
    3939  inline float getTotalMass( void ) const { return mass + massChildren; };
    4040
     41  /** @returns the velocity */
     42  inline const Vector getVelocity() { return this->velocity; }
     43  /** @returns the acceleration */
     44  inline const Vector getAcceleration() { return this->acceleration; }
     45
    4146  virtual void applyForce(const Vector& force);
    4247  virtual void applyField(Field* field);
     
    5156  float          massChildren;          //!< Sum of the masses of the children nodes
    5257
     58  Vector         velocity;              //!< the velocity of the masspoint
     59  Vector         acceleration;          //!< acceleration of the masspoint
     60
    5361  Vector         forceSum;              //!< Total central force for this tick
    5462  Quaternion     momentumSum;           //!< Total momentum in this tick
  • branches/cr/src/world_entities/world_entity.h

    r8099 r8106  
    8484  inline bool isReactive() const { return this->bReactive; }
    8585
    86   const CollisionHandle* getCollisionHandle(CREngine::CRType type) const { return this->collisionHandles[type]; }
     86  CollisionHandle* getCollisionHandle(CREngine::CRType type) const { return this->collisionHandles[type]; }
    8787
    8888
Note: See TracChangeset for help on using the changeset viewer.