This is a legacy Trac instance left read-only for reference purposes. More info. dev main | home

Changeset 184

Show
Ignore:
Timestamp:
02/27/2010 06:25:35 PM (2 years ago)
Author:
magicd
Message:

collisiondetection enable/disable for any body

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/include/waterworld/sim2/Animat.h

    r183 r184  
    5959                 */ 
    6060                void (*collision)(); 
     61 
     62                /** 
     63                 * On/Off collision detection for this body/animat 
     64                 */ 
     65                bool cde;       //CollisiondDetectionEnabled 
    6166        public: 
    6267                /** 
     
    6974                 */ 
    7075                void* getCollisionFunction(); 
     76 
     77                /** 
     78                 * \Set on/of collision detectcion 
     79                 */ 
     80                void setCollisionEnabled(bool); 
     81 
     82                /** 
     83                 * \Get on/of collision detect 
     84                 */ 
     85                bool isCollisionEnabled(); 
    7186 
    7287                /** 
  • trunk/src/waterworld/sim2/Animat.cpp

    r183 r184  
    5353        void* Animat::getCollisionFunction() 
    5454        { 
    55             return (void*) collision; 
     55            return (void*)collision; 
     56        } 
     57 
     58        void Animat::setCollisionEnabled(bool e) 
     59        { 
     60            cde = e; 
     61        } 
     62 
     63        bool Animat::isCollisionEnabled() 
     64        { 
     65            return cde; 
    5666        } 
    5767 
  • trunk/src/waterworld/sim2/World.cpp

    r182 r184  
    5959                { 
    6060                        (*i)->update(this, dt); 
    61                         palContact contact; 
    62                         pcd->GetContacts((palBodyBase *)(*i)->getPhysicalBody()->getBody(),contact); 
     61 
     62                        if((*i)->isCollisionEnabled()) 
     63                        { 
     64                            palContact contact; 
     65                            pcd->GetContacts((palBodyBase *)(*i)->getPhysicalBody()->getBody(),contact); 
     66                        } 
    6367                } 
    6468                palPhysics *tmp = getPhysics();