Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6112


Ignore:
Timestamp:
Nov 21, 2009, 12:57:06 AM (14 years ago)
Author:
scheusso
Message:

first attempts to have synchronised fire direction and target
however client cannot select targets yet (probably because of classtreemask hack)

Location:
code/branches/presentation2/src/orxonox
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc

    r6111 r6112  
    8181    void NewHumanController::tick(float dt)
    8282    {
    83         if( !this->controllableEntity_->isInMouseLook() )
     83        if( this->controllableEntity_ && !this->controllableEntity_->isInMouseLook() )
    8484        {
    8585            this->crossHairOverlay_->setPosition(Vector2(static_cast<float>(this->currentYaw_)/2*-1+.5-overlaySize_/2, static_cast<float>(this->currentPitch_)/2*-1+.5-overlaySize_/2));
     
    185185            pawn->setTarget( 0 );
    186186        }
    187 
    188     //return mouseRay.getOrigin() + mouseRay.getDirection() * 1200;
    189187   
    190188
  • code/branches/presentation2/src/orxonox/weaponsystem/WeaponMode.cc

    r6111 r6112  
    211211                muzzleDirection = pawn->getAimPosition() - this->muzzlePosition_;
    212212//             COUT(0) << "muzzleDirection " << muzzleDirection << endl;
    213                 //this->muzzleOrientation_ = this->weapon_->getWorldOrientation();
    214213            this->muzzleOrientation_ = (this->weapon_->getWorldOrientation() * WorldEntity::FRONT).getRotationTo(muzzleDirection) * this->weapon_->getWorldOrientation();
    215214        }
  • code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.cc

    r6108 r6112  
    5050
    5151    registerMemberNetworkFunction( ControllableEntity, fire );
     52    registerMemberNetworkFunction( ControllableEntity, setTargetInternal );
    5253
    5354    ControllableEntity::ControllableEntity(BaseObject* creator) : MobileEntity(creator)
     
    232233            callMemberNetworkFunction(ControllableEntity, fire, this->getObjectID(), 0, firemode);
    233234        }
     235    }
     236   
     237    void ControllableEntity::setTarget( WorldEntity* target )
     238    {
     239        this->target_ = target;
     240        if ( !GameMode::isMaster() )
     241        {
     242            if ( target != 0 )
     243            {
     244                callMemberNetworkFunction(ControllableEntity, setTargetInternal, this->getObjectID(), 0, target->getObjectID() );
     245            }
     246           else
     247           {
     248                callMemberNetworkFunction(ControllableEntity, setTargetInternal, this->getObjectID(), 0, OBJECTID_UNKNOWN );
     249           }
     250        }
     251    }
     252   
     253    void ControllableEntity::setTargetInternal( uint32_t targetID )
     254    {
     255        this->setTarget( orxonox_cast<WorldEntity*>(Synchronisable::getSynchronisable(targetID)) );
    234256    }
    235257
  • code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.h

    r6111 r6112  
    146146                { this->controller_ = val; }
    147147           
    148             virtual void setTarget( WorldEntity* target )
    149                 { this->target_ = target; }
     148            virtual void setTarget( WorldEntity* target );
    150149            virtual WorldEntity* getTarget()
    151150                { return this->target_.get(); }
     151            void setTargetInternal( uint32_t targetID );
    152152
    153153        protected:
  • code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.cc

    r6111 r6112  
    119119        registerVariable(this->initialHealth_, VariableDirection::ToClient);
    120120        registerVariable(this->bReload_,       VariableDirection::ToServer);
     121        registerVariable(this->aimPosition_,   Bidirectionality::ServerMaster, 0, true);
    121122    }
    122123
Note: See TracChangeset for help on using the changeset viewer.