Changeset 7052
- Timestamp:
- May 31, 2010, 3:40:41 PM (14 years ago)
- Location:
- code/branches/fps
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/fps/data/levels/includes/weaponsettings_fps.oxi
r6908 r7052 1 1 <weaponslots> 2 <WeaponSlot position="0,-6,0.5" yaw=0 pitch=0 roll=0 /> 3 <!-- <WeaponSlot position="15,-1.5,-25" yaw=0 pitch=0 roll=0 /> 2 <WeaponSlot position="0,0,0" yaw=0 pitch=0 roll=0 /> 3 <!-- <WeaponSlot position="-0.5,0.8,2.5" yaw=0 pitch=0 roll=0 /> 4 <WeaponSlot position="15,-1.5,-25" yaw=0 pitch=0 roll=0 /> 4 5 <WeaponSlot position="0,0,-45" yaw=0 pitch=0 roll=0 /> --> 5 6 </weaponslots> … … 16 17 </links> 17 18 <Weapon> 18 <attached> 19 <Model mesh="LightningGun.mesh" pitch="78" roll="90" yaw="90" position="0,-1.3,0" /> 20 <Model mesh="LightningGun-s.mesh" pitch="78" roll="90" yaw="90" position="0.2,-1.3,0" /> 21 <Model mesh="hs-w01.mesh" roll="195" position="0,1,0" scale=2 /> 22 <Model mesh="hs-w01s.mesh" roll="195" position="0.1,0.5,0" scale=2 /> 23 </attached> 24 <HsW01 mode=0 munitionpershot=0 delay=0.125 material="Flares/point_lensflare" muzzleoffset=" 0.7, 1.5,-4" /> 25 <HsW01 mode=0 munitionpershot=0 delay=0 material="Flares/point_lensflare" muzzleoffset="-0.9, 1.1,-4" /> 26 <LightningGun mode=1 muzzleoffset="0,0,0" /> 19 <HsW01 mode=0 munitionpershot=0 delay=0.0 material="Flares/point_lensflare" muzzleoffset=" 0.7, 1.5, -4" /> 20 <LightningGun mode=1 muzzleoffset="0,0,0" /> 27 21 </Weapon> 28 22 <LaserGun -
code/branches/fps/data/levels/presentation_FS10.oxw
r6908 r7052 23 23 <Pawn health=100 position="600,35,0" direction="0,-1,0" collisionType=dynamic mass=100000> 24 24 <attached> 25 <Model position="0,0,0" mesh=" crate.mesh" scale3D="5,5,5" />25 <Model position="0,0,0" mesh="fish.mesh" scale3D="5,5,5" /> 26 26 </attached> 27 27 <collisionShapes> … … 83 83 </collisionShapes> 84 84 </StaticEntity> 85 85 86 <?lua 86 87 for i = 1, 10, 1 … … 91 92 ?> 92 93 93 <!--94 <?lua95 for i = 1, 200, 196 do97 j = math.random()98 ?>99 94 100 <MovableEntity position="<?lua print(math.random() * 5000-2000) ?>,<?lua print(math.random() * 5000-2000) ?>,<?lua print(math.random() * 5000 - 2000) ?>" collisionType=dynamic linearDamping=0.8 angularDamping=0 mass=<?lua print(j * 100) ?> scale=<?lua print(j * 5) ?> rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>" >101 <attached>102 <Model position="0,0,0" scale=<?lua print(j * 10) ?> mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" />103 </attached>104 <collisionShapes>105 <SphereCollisionShape radius="<?lua print(j * 100) ?>" />106 </collisionShapes>107 </MovableEntity>108 <?lua109 end110 ?>111 -->112 95 </Scene> 113 96 </Level> -
code/branches/fps/data/levels/templates/fps.oxt
r6908 r7052 2 2 <FpsPlayer 3 3 hudtemplate = fpshud 4 camerapositiontemplate = fpscamera 5 4 6 5 spawnparticlesource = "Orxonox/fairytwirl" 7 6 spawnparticleduration = 3 … … 21 20 angularDamping = 0.9999999 22 21 friction = 0.01 22 23 weapon = "hs-w01.mesh" 23 24 > 24 <!-- <attached>25 <Model position="0,0,0" yaw=90 pitch=-90 roll=0 scale=4 mesh="assff.mesh" />26 <BlinkingBillboard position="17,-1.5,0" material="Examples/Flare" colour="1.0, 0.5, 0.3" amplitude=0.1 frequency=0.5 quadratic=1 />27 <BlinkingBillboard position="-17,-1.5,0" material="Examples/Flare" colour="0.5, 1.0, 0.3" amplitude=0.1 frequency=0.5 phase=180 quadratic=1 />28 </attached>29 -->30 25 <collisionShapes> 31 <BoxCollisionShape position="0,0,0" halfExtents="7,7,7" /> 32 <!-- 33 <SphereCollisionShape radius="10" /> 34 35 <BoxCollisionShape position="0,0,0" halfExtents="10, 3, 5" /> 36 <BoxCollisionShape position="13,-1.3,0" halfExtents="3, 1, 2" /> 37 <BoxCollisionShape position="-13,-1.3,0" halfExtents="3, 1, 2" /> 38 <BoxCollisionShape position="0,0,7" halfExtents="3, 2, 2" /> 39 <BoxCollisionShape position="0,0.1,-11" halfExtents="2.2, 1.8, 6" /> 40 <BoxCollisionShape position="0,0.1,-19" halfExtents="1.4, 1, 2" /> 41 --> 26 <BoxCollisionShape position="0,0,0" halfExtents="8,20,8" /> 42 27 </collisionShapes> 28 29 <camerapositions> 30 <CameraPosition position="-0.5,0.8,2.5" drag=false mouselook=true /> 31 </camerapositions> 32 33 <?lua 34 include("includes/weaponsettings_fps.oxi") 35 ?> 43 36 44 <?lua45 include("includes/weaponsettings_fps.oxi")46 ?>47 37 </FpsPlayer> 48 38 </Template> 49 39 <!-- 50 40 <Template name=fpscamera defaults=0> 51 41 <FpsPlayer> 52 42 <camerapositions> 53 43 <CameraPosition position="0,0,20" drag=false mouselook=true /> 54 <!--CameraPosition position="0,150,-25" pitch=-90 drag=true /> 44 45 <!-- 46 CameraPosition position="0,150,-25" pitch=-90 drag=true /> 55 47 <CameraPosition position="0,0,-40" yaw=180 drag=true /> 56 48 <CameraPosition position="0,3,-14" yaw=0 /> 57 49 <CameraPosition position="-50,5,-8" yaw=-90 drag=true /> 58 <CameraPosition position="50,5,-8" yaw=90 drag=true /--> 50 <CameraPosition position="50,5,-8" yaw=90 drag=true / 51 59 52 </camerapositions> 60 53 </FpsPlayer> 61 54 </Template> 55 --> -
code/branches/fps/src/orxonox/worldentities/pawns/FpsPlayer.cc
r6908 r7052 33 33 #include <LinearMath/btVector3.h> 34 34 #include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h> 35 35 #include <OgreSceneManager.h> 36 #include <OgreSceneNode.h> 37 #include <OgreEntity.h> 36 38 37 39 #include "core/CoreIncludes.h" … … 40 42 #include "core/XMLPort.h" 41 43 #include "items/Engine.h" 44 #include "Scene.h" 45 #include "weaponsystem/WeaponPack.h" 46 #include "weaponsystem/WeaponSlot.h" 47 #include "weaponsystem/Weapon.h" 42 48 43 49 #include <cmath> … … 80 86 this->registerVariables(); 81 87 88 this->weaponNode = this->cameraPositionRootNode_; 89 //this->weaponNode = this->getScene()->getRootSceneNode()->createChildSceneNode(); 90 //this->weaponNode = this->cameraPositionRootNode_->createChildSceneNode(); 91 this->attachNode(this->weaponNode); 82 92 } 83 93 84 94 FpsPlayer::~FpsPlayer() 85 95 { 96 if (this->isInitialized() && this->mesh_.getEntity()) 97 this->detachOgreObject(this->mesh_.getEntity()); 86 98 } 87 99 … … 93 105 XMLPortParamVariable(FpsPlayer, "auxilaryThrust", auxilaryThrust_, xmlelement, mode); 94 106 XMLPortParamVariable(FpsPlayer, "rotationThrust", rotationThrust_, xmlelement, mode); 107 XMLPortParam(FpsPlayer, "weapon", setMeshSource, getMeshSource, xmlelement, mode); 95 108 } 96 109 … … 100 113 registerVariable(this->auxilaryThrust_, VariableDirection::ToClient); 101 114 registerVariable(this->rotationThrust_, VariableDirection::ToClient); 102 } 115 registerVariable(this->weaponmashname); 116 } 117 118 103 119 104 120 void FpsPlayer::setConfigValues() … … 145 161 if (!this->isInMouseLook()) 146 162 { 147 this->yaw(Radian(this->yaw_ * this->getMouseLookSpeed()), WorldEntity::Parent);148 //this->pitch(Radian(this->pitch_ * this->getMouseLookSpeed())); 163 this->yaw(Radian(this->yaw_ * this->getMouseLookSpeed()), WorldEntity::Parent); 164 149 165 Radian pitch=this->cameraPositionRootNode_->getOrientation().getPitch(); 150 if( pitch<Radian(1.5707) && pitch>Radian(-1.5707) ) this->cameraPositionRootNode_->pitch(Radian(this->pitch_ * this->getMouseLookSpeed())); 166 if( pitch<Radian(1.5707) && pitch>Radian(-1.5707) ) { 167 //this->weaponNode->pitch(Radian(this->pitch_ * this->getMouseLookSpeed())); 168 this->cameraPositionRootNode_->pitch(Radian(this->pitch_ * this->getMouseLookSpeed())); 169 } 151 170 else if(pitch<Radian(-1.5707)){ 152 if(this->pitch_>0.0) this->cameraPositionRootNode_->pitch(Radian(this->pitch_ * this->getMouseLookSpeed())); 153 else if(pitch<Radian(-1.571)) this->cameraPositionRootNode_->pitch(-pitch+Radian(-1.570796)); 171 if(this->pitch_>0.0) { 172 //this->weaponNode->pitch(Radian(this->pitch_ * this->getMouseLookSpeed())); 173 this->cameraPositionRootNode_->pitch(Radian(this->pitch_ * this->getMouseLookSpeed())); 174 } 175 else if(pitch<Radian(-1.571)){ 176 //this->weaponNode->pitch(-pitch+Radian(-1.570796)); 177 this->cameraPositionRootNode_->pitch(-pitch+Radian(-1.570796)); 178 } 154 179 } 155 180 else if(pitch>Radian(1.5707)){ 156 if(this->pitch_<0.0) this->cameraPositionRootNode_->pitch(Radian(this->pitch_ * this->getMouseLookSpeed())); 157 else if(pitch>Radian(1.571)) this->cameraPositionRootNode_->pitch(-pitch+Radian(1.570796)); 181 if(this->pitch_<0.0) { 182 //this->weaponNode->pitch(Radian(this->pitch_ * this->getMouseLookSpeed())); 183 this->cameraPositionRootNode_->pitch(Radian(this->pitch_ * this->getMouseLookSpeed())); 184 } 185 else if(pitch>Radian(1.571)){ 186 //this->weaponNode->pitch(-pitch+Radian(1.570796)); 187 this->cameraPositionRootNode_->pitch(-pitch+Radian(1.570796)); 188 } 158 189 } 159 190 //this->weaponNode->setOrientation(this->cameraPositionRootNode_->getOrientation()); 160 191 161 // this->roll(Radian(this->roll_ * this->getMouseLookSpeed())); 162 } 192 } 163 193 164 194 this->yaw_ = this->pitch_ = this->roll_ = 0; … … 172 202 SUPER(FpsPlayer, tick, dt); 173 203 } 204 205 void FpsPlayer::changedMesh() 206 { 207 if (GameMode::showsGraphics()) 208 { 209 if (this->mesh_.getEntity()) 210 this->weaponNode->detachObject(this->mesh_.getEntity()); 211 212 this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_); 213 214 if (this->mesh_.getEntity()) 215 { 216 this->weaponNode->attachObject(this->mesh_.getEntity()); 217 } 218 } 219 } 174 220 175 221 void FpsPlayer::setPlayer(PlayerInfo* player) … … 244 290 } 245 291 292 void FpsPlayer::addedWeaponPack(WeaponPack* wPack) 293 { 294 for (size_t i = 0; i < wPack->getNumWeapons(); ++i) 295 { 296 Weapon* weapon = wPack->getWeapon(i); 297 if (weapon->getWeaponSlot()) 298 { 299 weapon->getWeaponSlot()->removeWeapon(); 300 weapon->detachFromParent(); 301 weapon->attachToNode(this->weaponNode); 302 } 303 } 304 } 246 305 } -
code/branches/fps/src/orxonox/worldentities/pawns/FpsPlayer.h
r6872 r7052 35 35 #include <LinearMath/btVector3.h> 36 36 #include "util/Math.h" 37 #include "tools/Mesh.h" 37 38 #include "Pawn.h" 38 39 … … 58 59 virtual void rotateRoll(const Vector2& value); 59 60 61 62 inline void setMeshSource(const std::string& meshname) 63 { this->meshSrc_ = meshname; this->changedMesh(); } 64 inline const std::string& getMeshSource() const 65 { return this->meshSrc_; } 66 60 67 void boost(); //acctually jump 61 68 … … 63 70 64 71 bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); 72 73 virtual void addedWeaponPack(WeaponPack* wPack); 65 74 66 75 protected: … … 75 84 float auxilaryThrust_; 76 85 float rotationThrust_; 86 std::string weaponmashname; 77 87 btVector3 localLinearAcceleration_; 78 88 btVector3 localAngularAcceleration_; … … 82 92 float speed_; 83 93 94 void changedMesh(); 95 Mesh mesh_; 96 std::string meshSrc_; 84 97 float yaw_; 85 98 float pitch_; … … 89 102 bool thistickboost; 90 103 Quaternion savedOrientation_; 104 Ogre::SceneNode* weaponNode; 105 Ogre::Camera* camera_; 91 106 }; 92 107 } -
code/branches/fps/src/orxonox/worldentities/pawns/Pawn.cc
r6540 r7052 331 331 { 332 332 if (this->weaponSystem_) 333 { 333 334 this->weaponSystem_->addWeaponPack(wPack); 335 this->addedWeaponPack(wPack); 336 } 334 337 } 335 338 … … 337 340 { 338 341 if (this->weaponSystem_) 342 { 339 343 if (!this->weaponSystem_->addWeaponPack(wPack)) 340 344 wPack->destroy(); 345 else 346 this->addedWeaponPack(wPack); 347 } 341 348 } 342 349 -
code/branches/fps/src/orxonox/worldentities/pawns/Pawn.h
r6540 r7052 90 90 void addWeaponPackXML(WeaponPack * wPack); 91 91 WeaponPack * getWeaponPack(unsigned int index) const; 92 93 virtual void addedWeaponPack(WeaponPack* wPack) {} 92 94 93 95 inline const WorldEntity* getWorldEntity() const
Note: See TracChangeset
for help on using the changeset viewer.