Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7070


Ignore:
Timestamp:
Jun 1, 2010, 2:42:24 PM (14 years ago)
Author:
edwind
Message:

by ED, cleaned up version (final…)

Location:
code/branches/fps/src/orxonox/worldentities/pawns
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/fps/src/orxonox/worldentities/pawns/FpsPlayer.cc

    r7052 r7070  
    5151namespace orxonox
    5252{
    53     const float orientationGain = 100;
    54     const float jumpvalue = 300;
     53    const float orientationGain_ = 100;
     54    const float jumpValue_ = 300;
    5555    CreateFactory(FpsPlayer);
    5656
     
    8686        this->registerVariables();
    8787
    88         this->weaponNode = this->cameraPositionRootNode_;
    89         //this->weaponNode = this->getScene()->getRootSceneNode()->createChildSceneNode();
    90         //this->weaponNode = this->cameraPositionRootNode_->createChildSceneNode();
    91         this->attachNode(this->weaponNode);
     88        //this->weaponNode = this->cameraPositionRootNode_;
     89        this->weaponNode_ = this->getScene()->getRootSceneNode()->createChildSceneNode();
     90        this->attachNode(this->weaponNode_);
    9291    }
    9392
     
    113112        registerVariable(this->auxilaryThrust_, VariableDirection::ToClient);
    114113        registerVariable(this->rotationThrust_, VariableDirection::ToClient);
    115         registerVariable(this->weaponmashname);
     114        registerVariable(this->weaponMashName_);
    116115    }
    117116   
     
    141140            this->setOrientation(savedOrientation_);
    142141           
    143             thistickboost=false;
     142            thisTickBoost_=false;
    144143           
    145144            float localSpeedSquared = this->localVelocity_.squaredLength();
     
    153152            this->localVelocity_.z *= localSpeed;
    154153            Vector3 temp = this->getOrientation() * this->localVelocity_;
    155             if(localVelocity_.y==jumpvalue) this->setVelocity(Vector3(temp.x, temp.y + this->getVelocity().y, temp.z));
     154            if(localVelocity_.y==jumpValue_) this->setVelocity(Vector3(temp.x, temp.y + this->getVelocity().y, temp.z));
    156155            else this->setVelocity(Vector3(temp.x, this->getVelocity().y, temp.z));
    157156            this->localVelocity_.x = 0;
     
    165164                Radian pitch=this->cameraPositionRootNode_->getOrientation().getPitch();
    166165                if( pitch<Radian(1.5707) && pitch>Radian(-1.5707) ) {
    167                         //this->weaponNode->pitch(Radian(this->pitch_ * this->getMouseLookSpeed()));
    168166                        this->cameraPositionRootNode_->pitch(Radian(this->pitch_ * this->getMouseLookSpeed()));
    169167                        }
    170168                else if(pitch<Radian(-1.5707)){
    171169                        if(this->pitch_>0.0) {
    172                                 //this->weaponNode->pitch(Radian(this->pitch_ * this->getMouseLookSpeed()));
    173170                                this->cameraPositionRootNode_->pitch(Radian(this->pitch_ * this->getMouseLookSpeed()));
    174171                                }
    175172                        else if(pitch<Radian(-1.571)){
    176                                 //this->weaponNode->pitch(-pitch+Radian(-1.570796));
    177173                                this->cameraPositionRootNode_->pitch(-pitch+Radian(-1.570796));
    178174                                }
     
    180176                else if(pitch>Radian(1.5707)){
    181177                        if(this->pitch_<0.0) {
    182                                 //this->weaponNode->pitch(Radian(this->pitch_ * this->getMouseLookSpeed()));
    183178                                this->cameraPositionRootNode_->pitch(Radian(this->pitch_ * this->getMouseLookSpeed()));
    184179                                }
    185180                        else if(pitch>Radian(1.571)){
    186                                 //this->weaponNode->pitch(-pitch+Radian(1.570796));
    187181                                this->cameraPositionRootNode_->pitch(-pitch+Radian(1.570796));
    188182                                }
    189183                }
    190                 //this->weaponNode->setOrientation(this->cameraPositionRootNode_->getOrientation());
     184                this->weaponNode_->setOrientation(this->cameraPositionRootNode_->getOrientation());
    191185               
    192186            }
     
    194188            this->yaw_ = this->pitch_ = this->roll_ = 0;
    195189           
    196             //Quaternion q=this->getOrientation();
    197             //if( q.y<0.99 ) this->setOrientation(q.w, q.x, 1.0, q.z);
    198190            this->setAngularVelocity(0.0, 0.0, 0.0);
    199191            savedOrientation_=this->getOrientation();
     
    208200        {
    209201            if (this->mesh_.getEntity())
    210                 this->weaponNode->detachObject(this->mesh_.getEntity());
     202                this->weaponNode_->detachObject(this->mesh_.getEntity());
    211203
    212204            this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_);
     
    214206            if (this->mesh_.getEntity())
    215207            {
    216                 this->weaponNode->attachObject(this->mesh_.getEntity());
     208                this->weaponNode_->attachObject(this->mesh_.getEntity());
    217209            }
    218210        }
     
    274266    void FpsPlayer::boost()                                     //acctually jump
    275267    {
    276         if(isfloor) {
    277                 if(!thistickboost) this->localVelocity_.y = jumpvalue;
     268        if(isFloor_) {
     269                if(!thisTickBoost_) this->localVelocity_.y = jumpValue_;
    278270                //this->physicalBody_->applyCentralImpulse(btVector3(0, jumpvalue, 0));
    279                 thistickboost=true;
    280                 isfloor=false;
     271                thisTickBoost_=true;
     272                isFloor_=false;
    281273        }
    282274    }
     
    284276    bool FpsPlayer::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    285277    {
    286         if(contactPoint.m_normalWorldOnB.y() > 0.6) isfloor=true;
    287         else isfloor=false;
     278        if(contactPoint.m_normalWorldOnB.y() > 0.6) isFloor_=true;
     279        else isFloor_=false;
    288280       
    289281        return false;
     
    299291                weapon->getWeaponSlot()->removeWeapon();
    300292                weapon->detachFromParent();
    301                 weapon->attachToNode(this->weaponNode);
     293                weapon->attachToNode(this->weaponNode_);
    302294            }
    303295        }
  • code/branches/fps/src/orxonox/worldentities/pawns/FpsPlayer.h

    r7052 r7070  
    8484            float auxilaryThrust_;
    8585            float rotationThrust_;
    86             std::string weaponmashname;
     86            std::string weaponMashName_;
    8787            btVector3 localLinearAcceleration_;
    8888            btVector3 localAngularAcceleration_;
     
    9999            float roll_;
    100100            Vector3 localVelocity_;
    101             bool isfloor;
    102             bool thistickboost;
     101            bool isFloor_;
     102            bool thisTickBoost_;
    103103            Quaternion savedOrientation_;
    104             Ogre::SceneNode* weaponNode;
    105             Ogre::Camera* camera_;
    106     };
     104            Ogre::SceneNode* weaponNode_;
     105        };
    107106}
    108107
Note: See TracChangeset for help on using the changeset viewer.