Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 15, 2008, 9:40:09 PM (16 years ago)
Author:
rgrieder
Message:

Fixed bug that caused MovableEntities to jump around on the client.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/src/orxonox/objects/worldentities/MovableEntity.cc

    r2459 r2470  
    3434#include "core/XMLPort.h"
    3535#include "core/Executor.h"
     36#include "core/Core.h"
    3637#include "tools/Timer.h"
    3738
     
    4950        this->overwrite_position_    = Vector3::ZERO;
    5051        this->overwrite_orientation_ = Quaternion::IDENTITY;
    51        
    52         this->setPriority( priority::low );
    5352
    54         // Resynchronise every few seconds because we only work with velocities (no positions)
    55         continuousResynchroTimer_ = new Timer<MovableEntity>(CONTINUOUS_SYNCHRONIZATION_TIME + rnd(-1, 1),
    56                 true, this, createExecutor(createFunctor(&MovableEntity::resynchronize)), false);
     53        this->continuousResynchroTimer_ = 0;
     54
     55        this->setPriority(priority::low);
    5756
    5857        this->registerVariables();
     
    6261    {
    6362        if (this->isInitialized())
    64             delete this->continuousResynchroTimer_;
     63            if (this->continuousResynchroTimer_)
     64                delete this->continuousResynchroTimer_;
    6565    }
    6666
     
    9090    void MovableEntity::resynchronize()
    9191    {
     92        if (Core::isMaster() && !this->continuousResynchroTimer_)
     93        {
     94            // Resynchronise every few seconds because we only work with velocities (no positions)
     95            continuousResynchroTimer_ = new Timer<MovableEntity>(CONTINUOUS_SYNCHRONIZATION_TIME + rnd(-1, 1),
     96                true, this, createExecutor(createFunctor(&MovableEntity::resynchronize)), false);
     97        }
     98
    9299        this->overwrite_position_ = this->getPosition();
    93100        this->overwrite_orientation_ = this->getOrientation();
Note: See TracChangeset for help on using the changeset viewer.