Changeset 6108
- Timestamp:
- Nov 20, 2009, 8:15:25 PM (15 years ago)
- Location:
- code/branches/presentation2
- Files:
-
- 20 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2
- Property svn:mergeinfo changed
/code/branches/steering (added) merged: 5979,5981,5984,5993,6001,6033,6045,6052,6055,6058,6091
- Property svn:mergeinfo changed
-
code/branches/presentation2/data/defaultConfig/keybindings.ini
r5929 r6108 122 122 KeyStop= 123 123 KeySystemRequest= 124 KeyT= 125 KeyTab=" cycleNavigationFocus"126 KeyU= 124 KeyT="" 125 KeyTab="NewHumanController changeMode" 126 KeyU="" 127 127 KeyUP="scale 1 moveFrontBack" 128 128 KeyUnassigned="openConsole" -
code/branches/presentation2/src/libraries/core/input/InputManager.cc
r6105 r6108 631 631 { 632 632 // not scheduled for destruction 633 // prevents a state being added multiple times633 // prevents a state from being added multiple times 634 634 stateEnterRequests_.insert(it->second); 635 635 return true; 636 636 } 637 637 } 638 else if (this->stateLeaveRequests_.find(it->second) != this->stateLeaveRequests_.end()) 639 { 640 // State already scheduled for leaving --> cancel 641 this->stateLeaveRequests_.erase(this->stateLeaveRequests_.find(it->second)); 642 } 638 643 } 639 644 return false; … … 658 663 return true; 659 664 } 665 else if (this->stateEnterRequests_.find(it->second) != this->stateEnterRequests_.end()) 666 { 667 // State already scheduled for entering --> cancel 668 this->stateEnterRequests_.erase(this->stateEnterRequests_.find(it->second)); 669 } 660 670 } 661 671 return false; -
code/branches/presentation2/src/modules/weapons/weaponmodes/HsW01.cc
r5929 r6108 39 39 #include "weaponsystem/WeaponPack.h" 40 40 #include "weaponsystem/WeaponSystem.h" 41 #include "worldentities/WorldEntity.h" 41 42 42 43 namespace orxonox … … 110 111 model->setScale(5); 111 112 113 this->computeMuzzleParameters(); 112 114 projectile->setOrientation(this->getMuzzleOrientation()); 113 115 projectile->setPosition(this->getMuzzlePosition()); -
code/branches/presentation2/src/orxonox/controllers/CMakeLists.txt
r5781 r6108 2 2 Controller.cc 3 3 HumanController.cc 4 NewHumanController.cc 4 5 ArtificialController.cc 5 6 AIController.cc -
code/branches/presentation2/src/orxonox/controllers/Controller.cc
r5781 r6108 29 29 #include "Controller.h" 30 30 #include "core/CoreIncludes.h" 31 #include "worldentities/ControllableEntity.h" 31 32 32 33 namespace orxonox -
code/branches/presentation2/src/orxonox/controllers/Controller.h
r6107 r6108 54 54 virtual void changedControllableEntity() {} 55 55 56 virtual bool canFindTarget() 57 { return false; } 58 virtual Vector3 getTarget() 59 { return Vector3::ZERO; } 60 56 61 protected: 57 62 // don't use this directly, use getPlayer()->startControl(entity) (unless you know exactly what you do) … … 65 70 } 66 71 72 protected: 67 73 PlayerInfo* player_; 68 74 ControllableEntity* controllableEntity_; -
code/branches/presentation2/src/orxonox/controllers/HumanController.cc
r5929 r6108 113 113 } 114 114 115 void HumanController:: rotateYaw(const Vector2& value)115 void HumanController::yaw(const Vector2& value) 116 116 { 117 117 //Hack to enable mouselook in map … … 125 125 } 126 126 127 void HumanController:: rotatePitch(const Vector2& value)127 void HumanController::pitch(const Vector2& value) 128 128 { 129 129 //Hack to enable mouselook in map … … 143 143 } 144 144 145 void HumanController:: fire(unsigned int firemode)145 void HumanController::doFire(unsigned int firemode) 146 146 { 147 147 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) -
code/branches/presentation2/src/orxonox/controllers/HumanController.h
r5929 r6108 49 49 static void moveUpDown(const Vector2& value); 50 50 51 static void rotateYaw(const Vector2& value) ;52 static void rotatePitch(const Vector2& value) ;51 static void rotateYaw(const Vector2& value){ HumanController::localController_s->yaw(value); } 52 static void rotatePitch(const Vector2& value){ HumanController::localController_s->pitch(value); } 53 53 static void rotateRoll(const Vector2& value); 54 55 virtual void yaw(const Vector2& value); 56 virtual void pitch(const Vector2& value); 54 57 55 static void fire(unsigned int firemode); 58 static void fire(unsigned int firemode) { HumanController::localController_s->doFire(firemode); } 59 virtual void doFire(unsigned int firemode); 56 60 static void reload(); 57 61 … … 76 80 friend class Map; 77 81 78 pr ivate:82 protected: 79 83 static HumanController* localController_s; 80 84 }; -
code/branches/presentation2/src/orxonox/graphics/Camera.cc
r5929 r6108 61 61 62 62 this->camera_ = this->getScene()->getSceneManager()->createCamera(getUniqueNumberString()); 63 this->camera_->setUserObject(this); 63 64 this->cameraNode_ = this->getScene()->getRootSceneNode()->createChildSceneNode(); 64 65 this->attachNode(this->cameraNode_); -
code/branches/presentation2/src/orxonox/graphics/Camera.h
r5781 r6108 52 52 void releaseFocus(); 53 53 54 inline Ogre::Camera* getOgreCamera() 55 { return this->camera_; } 56 54 57 inline bool hasFocus() 55 58 { return this->bHasFocus_; } -
code/branches/presentation2/src/orxonox/infos/HumanPlayer.cc
r5929 r6108 35 35 #include "network/Host.h" 36 36 #include "controllers/HumanController.h" 37 #include "controllers/NewHumanController.h" 37 38 #include "gametypes/Gametype.h" 38 39 #include "overlays/OverlayGroup.h" … … 50 51 51 52 this->bHumanPlayer_ = true; 52 this->defaultController_ = Class( HumanController);53 this->defaultController_ = Class(NewHumanController); 53 54 54 55 this->humanHud_ = 0; -
code/branches/presentation2/src/orxonox/infos/PlayerInfo.cc
r6107 r6108 139 139 this->controller_->setPlayer(this); 140 140 if (this->controllableEntity_) 141 { 141 142 this->controller_->setControllableEntity(this->controllableEntity_); 143 this->controllableEntity_->setController(this->controller_); 144 } 142 145 this->changedController(); 143 146 } … … 161 164 162 165 if (this->controller_) 166 { 163 167 this->controller_->setControllableEntity(entity); 168 this->controllableEntity_->setController(this->controller_); 169 } 164 170 165 171 this->changedControllableEntity(); … … 195 201 return; 196 202 203 this->controllableEntity_->setController(0); 197 204 this->controllableEntity_ = 0; 198 205 this->controllableEntityID_ = OBJECTID_UNKNOWN; -
code/branches/presentation2/src/orxonox/overlays/OrxonoxOverlay.h
r6057 r6108 155 155 static void rotateOverlay(const std::string& name, const Degree& angle); 156 156 157 void setBackgroundMaterial(const std::string& material); 158 const std::string& getBackgroundMaterial() const; 159 157 160 virtual void changedVisibility(); 158 161 … … 181 184 virtual void positionChanged(); 182 185 183 void setBackgroundMaterial(const std::string& material);184 const std::string& getBackgroundMaterial() const;185 186 186 Ogre::Overlay* overlay_; //!< The overlay the entire class is about. 187 187 Ogre::PanelOverlayElement* background_; //!< Background image (blank per default). -
code/branches/presentation2/src/orxonox/weaponsystem/WeaponMode.cc
r5929 r6108 32 32 #include "core/CoreIncludes.h" 33 33 #include "core/XMLPort.h" 34 #include "controllers/Controller.h" 35 #include "worldentities/pawns/Pawn.h" 34 36 35 37 #include "Munition.h" … … 194 196 } 195 197 196 Vector3 WeaponMode::getMuzzlePosition() const198 void WeaponMode::computeMuzzleParameters() 197 199 { 198 200 if (this->weapon_) 199 return (this->weapon_->getWorldPosition() + this->weapon_->getWorldOrientation() * this->muzzleOffset_); 200 else 201 return this->muzzleOffset_; 202 } 203 204 const Quaternion& WeaponMode::getMuzzleOrientation() const 201 { 202 this->muzzlePosition_ = this->weapon_->getWorldPosition() + this->weapon_->getWorldOrientation() * this->muzzleOffset_; 203 204 Controller* controller = this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getController(); 205 if (controller->canFindTarget()) 206 { 207 Vector3 muzzleDirection(controller->getTarget() - this->muzzlePosition_); 208 this->muzzleOrientation_ = (this->weapon_->getWorldOrientation() * WorldEntity::FRONT).getRotationTo(muzzleDirection) * this->weapon_->getWorldOrientation(); 209 } 210 else 211 this->muzzleOrientation_ = this->weapon_->getWorldOrientation(); 212 } 213 else 214 { 215 this->muzzlePosition_ = this->muzzleOffset_; 216 this->muzzleOrientation_ = Quaternion::IDENTITY; 217 } 218 } 219 220 Vector3 WeaponMode::getMuzzleDirection() const 205 221 { 206 222 if (this->weapon_) 207 return this->weapon_->getWorldOrientation(); 208 else 209 return Quaternion::IDENTITY; 210 } 211 212 Vector3 WeaponMode::getMuzzleDirection() const 213 { 214 if (this->weapon_) 215 return (this->weapon_->getWorldOrientation() * WorldEntity::FRONT); 223 return (this->getMuzzleOrientation() * WorldEntity::FRONT); 216 224 else 217 225 return WorldEntity::FRONT; -
code/branches/presentation2/src/orxonox/weaponsystem/WeaponMode.h
r5929 r6108 109 109 { return this->muzzleOffset_; } 110 110 111 Vector3 getMuzzlePosition() const; 112 const Quaternion& getMuzzleOrientation() const; 111 void computeMuzzleParameters(); 112 const Vector3& getMuzzlePosition() const 113 { return this->muzzlePosition_; } 114 const Quaternion& getMuzzleOrientation() const 115 { return this->muzzleOrientation_; } 113 116 Vector3 getMuzzleDirection() const; 114 117 … … 124 127 inline unsigned int getMode() const 125 128 { return this->mode_; } 129 130 Vector3 getTarget(); 126 131 127 132 protected: … … 152 157 Timer reloadTimer_; 153 158 bool bReloading_; 159 160 Vector3 muzzlePosition_; 161 Quaternion muzzleOrientation_; 154 162 }; 155 163 } -
code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.cc
r6107 r6108 65 65 this->camera_ = 0; 66 66 this->xmlcontroller_ = 0; 67 this->controller_ = 0; 67 68 this->reverseCamera_ = 0; 68 69 this->bDestroyWhenPlayerLeft_ = false; -
code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.h
r6107 r6108 140 140 inline Controller* getXMLController() const 141 141 { return this->xmlcontroller_; } 142 143 inline Controller* getController() const 144 { return this->controller_; } 145 inline void setController(Controller* val) 146 { this->controller_ = val; } 142 147 143 148 protected: … … 202 207 std::string cameraPositionTemplate_; 203 208 Controller* xmlcontroller_; 209 Controller* controller_; 204 210 CameraPosition* reverseCamera_; 205 211 }; -
code/branches/presentation2/src/orxonox/worldentities/WorldEntity.cc
r5929 r6108 472 472 //! Attaches an Ogre::MovableObject to this WorldEntity. 473 473 void WorldEntity::attachOgreObject(Ogre::MovableObject* object) 474 { this->node_->attachObject(object); } 474 { 475 this->node_->attachObject(object); 476 object->setUserObject(this); 477 } 478 475 479 void WorldEntity::attachOgreObject(Ogre::BillboardSet* object) 476 { this-> node_->attachObject(object); }480 { this->attachOgreObject(static_cast<Ogre::MovableObject*>(object)); } 477 481 void WorldEntity::attachOgreObject(Ogre::Camera* object) 478 { this-> node_->attachObject(object); }482 { this->attachOgreObject(static_cast<Ogre::MovableObject*>(object)); } 479 483 void WorldEntity::attachOgreObject(Ogre::Entity* object) 480 { this-> node_->attachObject(object); }484 { this->attachOgreObject(static_cast<Ogre::MovableObject*>(object)); } 481 485 void WorldEntity::attachOgreObject(Ogre::ParticleSystem* object) 482 { this-> node_->attachObject(object); }486 { this->attachOgreObject(static_cast<Ogre::MovableObject*>(object)); } 483 487 484 488 //! Detaches an Ogre::MovableObject from this WorldEntity. 485 489 void WorldEntity::detachOgreObject(Ogre::MovableObject* object) 486 { this->node_->detachObject(object); } 490 { 491 object->setUserObject(NULL); 492 this->node_->detachObject(object); 493 } 494 487 495 void WorldEntity::detachOgreObject(Ogre::BillboardSet* object) 488 { this-> node_->detachObject(object); }496 { this->detachOgreObject(static_cast<Ogre::MovableObject*>(object)); } 489 497 void WorldEntity::detachOgreObject(Ogre::Camera* object) 490 { this-> node_->detachObject(object); }498 { this->detachOgreObject(static_cast<Ogre::MovableObject*>(object)); } 491 499 void WorldEntity::detachOgreObject(Ogre::Entity* object) 492 { this-> node_->detachObject(object); }500 { this->detachOgreObject(static_cast<Ogre::MovableObject*>(object)); } 493 501 void WorldEntity::detachOgreObject(Ogre::ParticleSystem* object) 494 { this-> node_->detachObject(object); }502 { this->detachOgreObject(static_cast<Ogre::MovableObject*>(object)); } 495 503 496 504 //! Detaches an Ogre::MovableObject (by string) from this WorldEntity. … … 646 654 /** 647 655 @brief 648 Makes this WorldEntity look a specific target location.656 Makes this WorldEntity look at a specific target location. 649 657 @param relativeTo 650 658 @see WorldEntity::TransformSpace … … 913 921 } 914 922 915 //! Copies our own parameters for restitution, angular factor, damping sand friction to the bullet rigid body.923 //! Copies our own parameters for restitution, angular factor, damping and friction to the bullet rigid body. 916 924 void WorldEntity::internalSetPhysicsProps() 917 925 { -
code/branches/presentation2/src/orxonox/worldentities/WorldEntity.h
r5781 r6108 33 33 #include "OrxonoxPrereqs.h" 34 34 35 #include <OgreUserDefinedObject.h> 35 36 #ifdef ORXONOX_RELEASE 36 37 # include <OgreSceneNode.h> … … 55 56 56 57 The basic task of the WorldEntity is provide a location, a direction and a scaling and the possibility 57 to create an entire hierarchy of deriv ated objects.58 to create an entire hierarchy of derived objects. 58 59 It is also the basis for the physics interface to the Bullet physics engine. 59 60 Every WorldEntity can have a specific collision type: @see CollisionType … … 63 64 There is also support for attaching WorldEntities with physics to each other. Currently, the collision shape 64 65 of both objects simply get merged into one larger shape (for static collision type). 65 The phy iscal body that is internally stored and administrated has the following supported properties:66 - Restitution, angular factor, linear damping, angular damping, fric ition, mass and collision shape.66 The physical body that is internally stored and administrated has the following supported properties: 67 - Restitution, angular factor, linear damping, angular damping, friction, mass and collision shape. 67 68 You can get more information at the corresponding set function. 68 69 69 70 Collision shapes: These are controlled by the internal WorldEntityCollisionShape. @see WorldEntityCollisionShape. 70 71 */ 71 class _OrxonoxExport WorldEntity : public BaseObject, public Synchronisable, public btMotionState 72 class _OrxonoxExport WorldEntity : public BaseObject, public Synchronisable, public btMotionState, public Ogre::UserDefinedObject 72 73 { 73 74 friend class Scene; … … 318 319 Sets an artificial parameter that tells how much torque is applied when you apply a non-central force. 319 320 320 Normally the angular factor is 1, which means it's physically 'correct'. Howe rver if you have a player321 Normally the angular factor is 1, which means it's physically 'correct'. However if you have a player 321 322 character that should not rotate when hit sideways, you can set the angular factor to 0. 322 323 */ … … 394 395 You can override this function in a derived class to constrain the collision to e.g. None or Dynamic. 395 396 A projectile may not prove very useful if there is no physical body. Simply set the CollisionType 396 in its constructor and override this method. But be careful that a derived class e's virtual functions397 in its constructor and override this method. But be careful that a derived class's virtual functions 397 398 don't yet exist in the constructor if a base class. 398 399 */
Note: See TracChangeset
for help on using the changeset viewer.