Changeset 8731 in orxonox.OLD for trunk/src/world_entities/creatures
- Timestamp:
- Jun 22, 2006, 4:28:18 PM (19 years ago)
- Location:
- trunk/src/world_entities/creatures
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/creatures/fps_player.cc
r8724 r8731 18 18 19 19 #include "interactive_model.h" 20 #include " md2/md2Model.h"20 #include "state.h" 21 21 22 22 #include "src/lib/util/loading/factory.h" … … 28 28 29 29 30 30 31 CREATE_FACTORY(FPSPlayer, CL_FPS_PLAYER); 31 32 33 using namespace std;34 32 35 33 … … 72 70 this->bBackward = false; 73 71 this->bJump = false; 72 74 73 this->xMouse = 0.0f; 75 74 this->yMouse = 0.0f; … … 78 77 this->setHealth(80); 79 78 80 this->mouseDir = this->getAbsDir(); 79 80 this->cameraNode.setParent(this); 81 82 this->attitude = this->getAbsDir().getAttitude(); 83 this->heading = this->getAbsDir().getHeading(); 81 84 82 85 //add events to the eventlist … … 91 94 this->getWeaponManager().setSlotCount(0); 92 95 93 this->getWeaponManager().getFixedTarget()->setParent(this);94 this->getWeaponManager().getFixedTarget()->setRelCoor(100000,0,0);95 96 96 97 dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false); … … 101 102 registerVar( new SynchronizeableBool( &bForward, &bForward, "bForward", PERMISSION_OWNER ) ); 102 103 registerVar( new SynchronizeableBool( &bBackward, &bBackward, "bBackward", PERMISSION_OWNER ) ); 103 registerVar( new SynchronizeableQuaternion( &mouseDir, &mouseDir, "mouseDir", PERMISSION_OWNER ) );104 // registerVar( new SynchronizeableQuaternion( &mouseDir, &mouseDir, "mouseDir", PERMISSION_OWNER ) ); 104 105 105 106 // collision reaction registration … … 119 120 void FPSPlayer::setPlayDirection(const Quaternion& quat, float speed) 120 121 { 121 this->mouseDir = quat; 122 this->angleY = quat.getHeading(); 123 this->angleX = quat.getAttitude(); 122 this->attitude = this->getAbsDir().getAttitude(); 123 this->heading = this->getAbsDir().getHeading(); 124 124 } 125 125 … … 140 140 void FPSPlayer::enter() 141 141 { 142 dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false ); 143 this->attachCamera(); 142 dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( true ); 143 144 State::getCameraNode()->setParentSoft(&this->cameraNode); 145 State::getCameraTargetNode()->setParentSoft(&this->cameraNode); 146 147 this->getWeaponManager().getFixedTarget()->setParent(State::getCameraTargetNode()); 148 this->getWeaponManager().getFixedTarget()->setRelCoor(0,0,0); 149 150 151 State::getCameraNode()->setRelCoor(0,0,0); 152 State::getCameraTargetNode()->setRelCoor(10,0,0); 144 153 } 145 154 … … 165 174 yMouse *= time ; 166 175 167 angleX -= xMouse; 168 angleY -= yMouse; 169 170 if ( angleY > 2.05 ) 171 angleY = 2.05; 172 173 if ( angleY < -1.15 ) 174 angleY = -1.15; 175 176 this->mouseDir = Quaternion( angleX, Vector( 0, 1, 0 ) ) * Quaternion( angleY, Vector( 0, 0, 1 ) ); 176 heading -= xMouse; 177 attitude-= yMouse; 178 179 if ( attitude > 2.05 ) 180 attitude = 2.05; 181 182 else if ( attitude < -1.15 ) 183 attitude = -1.15; 184 185 this->setAbsDir(Quaternion(heading, Vector(0,1,0))); 186 this->cameraNode.setRelDir(Quaternion( attitude, Vector( 0, 0, 1 ) )); 177 187 178 188 xMouse = yMouse = 0; 179 189 } 180 190 181 this->setAbsDir( this->mouseDir );191 // this->setAbsDir( this->mouseDir ); 182 192 183 193 Vector velocity; -
trunk/src/world_entities/creatures/fps_player.h
r8724 r8731 45 45 float xMouse; //!< mouse moved in x-Direction 46 46 float yMouse; //!< mouse moved in y-Direction 47 Quaternion mouseDir; //!< the direction where the player wants to fly48 47 49 float angleX;50 float angleY;51 48 49 float heading; 50 float attitude; 51 52 PNode cameraNode; 52 53 }; 53 54
Note: See TracChangeset
for help on using the changeset viewer.