Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 11, 2008, 1:54:35 PM (15 years ago)
Author:
rgrieder
Message:
  • Removed debug output
  • Fixed a bug with parentID_ in CollisionShape
  • Reactivated overwrite mechanism in ControllableEntity
  • Build fix in WE for last commit.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/physics/src/orxonox/objects/worldentities/ControllableEntity.cc

    r2374 r2407  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
    25  *      ...
     25 *      Reto Grieder
    2626 *
    2727 */
     
    256256    {
    257257        if (!this->bControlled_)
    258         {
    259             //COUT(0) << "override with server position: " << this << std::endl;
    260258            this->setPosition(this->server_position_);
    261         }
    262259    }
    263260
     
    282279    void ControllableEntity::processOverwrite()
    283280    {
    284         //if (this->bControlled_)
    285         //{
    286         //    COUT(0) << "complete override: " << this << std::endl;
    287         //    this->setPosition(this->server_position_);
    288         //    this->setVelocity(this->server_velocity_);
    289         //    this->setOrientation(this->server_orientation_);
    290 
    291         //    this->client_overwrite_ = this->server_overwrite_;
    292         //}
     281        if (this->bControlled_)
     282        {
     283            this->setPosition(this->server_position_);
     284            this->setOrientation(this->server_orientation_);
     285            this->setVelocity(this->server_linear_velocity_);
     286            this->setAngularVelocity(this->server_angular_velocity_);
     287
     288            this->client_overwrite_ = this->server_overwrite_;
     289        }
    293290    }
    294291
    295292    void ControllableEntity::processClientPosition()
    296293    {
    297         //if (this->server_overwrite_ == this->client_overwrite_)
    298         if (!this->bControlled_)
    299         {
    300             //COUT(0) << "override with client position: " << this << std::endl;
    301 //            COUT(2) << "callback: setting client position" << endl;
     294        if (this->server_overwrite_ == this->client_overwrite_)
     295        {
    302296            this->setPosition(this->client_position_);
    303             //this->server_position_ = this->client_position_;
    304         }
    305         //else
    306         //  COUT(2) << "callback: not setting client position" << endl;
     297            // The call above increments the overwrite. This is not desired to reduce traffic
     298            --this->server_overwrite_;
     299        }
    307300    }
    308301
    309302    void ControllableEntity::processClientLinearVelocity()
    310303    {
    311         if (!this->bControlled_)
    312         //if (this->server_overwrite_ == this->client_overwrite_)
     304        if (this->server_overwrite_ == this->client_overwrite_)
    313305        {
    314306            this->setVelocity(this->client_linear_velocity_);
    315             //this->server_velocity_ = this->client_velocity_;
     307            // The call above increments the overwrite. This is not desired to reduce traffic
     308            --this->server_overwrite_;
    316309        }
    317310    }
     
    319312    void ControllableEntity::processClientOrientation()
    320313    {
    321         if (!this->bControlled_)
    322         //if (this->server_overwrite_ == this->client_overwrite_)
     314        if (this->server_overwrite_ == this->client_overwrite_)
    323315        {
    324316            this->setOrientation(this->client_orientation_);
    325             //this->server_orientation_ = this->client_orientation_;
     317            // The call above increments the overwrite. This is not desired to reduce traffic
     318            --this->server_overwrite_;
    326319        }
    327320    }
     
    329322    void ControllableEntity::processClientAngularVelocity()
    330323    {
    331         if (!this->bControlled_)
    332         //if (this->server_overwrite_ == this->client_overwrite_)
     324        if (this->server_overwrite_ == this->client_overwrite_)
    333325        {
    334326            this->setAngularVelocity(this->client_angular_velocity_);
    335             //this->server_velocity_ = this->client_velocity_;
     327            // The call above increments the overwrite. This is not desired to reduce traffic
     328            --this->server_overwrite_;
    336329        }
    337330    }
     
    342335        {
    343336            this->server_position_ = this->getPosition();
    344             ++this->server_overwrite_;
     337            if (!bContinuous)
     338                ++this->server_overwrite_;
    345339        }
    346340        else if (this->bControlled_)
     
    355349        {
    356350            this->server_orientation_ = this->getOrientation();
    357             ++this->server_overwrite_;
     351            if (!bContinuous)
     352                ++this->server_overwrite_;
    358353        }
    359354        else if (this->bControlled_)
     
    368363        {
    369364            this->server_linear_velocity_ = this->getVelocity();
    370             ++this->server_overwrite_;
     365            if (!bContinuous)
     366                ++this->server_overwrite_;
    371367        }
    372368        else if (this->bControlled_)
     
    381377        {
    382378            this->server_angular_velocity_ = this->getAngularVelocity();
    383             ++this->server_overwrite_;
     379            if (!bContinuous)
     380                ++this->server_overwrite_;
    384381        }
    385382        else if (this->bControlled_)
Note: See TracChangeset for help on using the changeset viewer.