Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2851 for code/trunk/src


Ignore:
Timestamp:
Mar 26, 2009, 11:59:39 AM (16 years ago)
Author:
landauf
Message:

Fixed attachment of "absolute" CameraPosition-Nodes in the Network (this refers to the top-down camera in Pong)

Location:
code/trunk/src/orxonox/objects/worldentities
Files:
4 edited

Legend:

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

    r2839 r2851  
    335335    }
    336336
     337    void ControllableEntity::parentChanged()
     338    {
     339        WorldEntity::parentChanged();
     340
     341        WorldEntity* parent = this->getParent();
     342        if (parent)
     343        {
     344            for (std::list<CameraPosition*>::iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
     345                if ((*it)->getIsAbsolute())
     346                    parent->attach((*it));
     347        }
     348    }
     349
    337350    void ControllableEntity::tick(float dt)
    338351    {
  • code/trunk/src/orxonox/objects/worldentities/ControllableEntity.h

    r2839 r2851  
    137137            virtual void startLocalHumanControl();
    138138            virtual void stopLocalHumanControl();
     139            virtual void parentChanged();
    139140
    140141            inline void setHudTemplate(const std::string& name)
  • code/trunk/src/orxonox/objects/worldentities/WorldEntity.cc

    r2787 r2851  
    181181
    182182        // Attach to parent if necessary
    183         registerVariable(this->parentID_,       variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::parentChanged));
     183        registerVariable(this->parentID_,       variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::networkcallback_parentChanged));
    184184    }
    185185
     
    188188        Network function that object this instance to its correct parent.
    189189    */
    190     void WorldEntity::parentChanged()
     190    void WorldEntity::networkcallback_parentChanged()
    191191    {
    192192        if (this->parentID_ != OBJECTID_UNKNOWN)
     
    362362        this->parentID_ = newParent->getObjectID();
    363363
     364        this->parentChanged();
     365
    364366        // apply transform to collision shape
    365367        this->collisionShape_->setPosition(this->getPosition());
    366368        this->collisionShape_->setOrientation(this->getOrientation());
    367369        // TODO: Scale
    368        
     370
    369371        return true;
    370372    }
     
    406408        this->parent_ = 0;
    407409        this->parentID_ = OBJECTID_UNKNOWN;
     410
     411        this->parentChanged();
    408412
    409413        // reset orientation of the collisionShape (cannot be set within a WE usually)
  • code/trunk/src/orxonox/objects/worldentities/WorldEntity.h

    r2787 r2851  
    176176
    177177        protected:
     178            virtual void parentChanged() {}
     179
    178180            Ogre::SceneNode* node_;
    179181
     
    191193
    192194            // network callbacks
    193             void parentChanged();
     195            void networkcallback_parentChanged();
    194196            inline void scaleChanged()
    195197                { this->setScale3D(this->getScale3D()); }
     
    269271            @brief
    270272                Sets how much reaction is applied in a collision.
    271                
     273
    272274                Consider two equal spheres colliding with equal velocities:
    273275                Restitution 1 means that both spheres simply reverse their velocity (no loss of energy)
Note: See TracChangeset for help on using the changeset viewer.