Changeset 10784 for code/branches/hoverHS15
- Timestamp:
- Nov 9, 2015, 2:09:38 PM (9 years ago)
- Location:
- code/branches/hoverHS15
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hoverHS15/data/levels/templates/spaceshipHover.oxt
r10760 r10784 1 1 <Template name=spaceshiphover> 2 <HoverShip 2 <SpaceShip 3 hudtemplate = spaceshiphud 3 4 camerapositiontemplate = spaceshiphovercameras 4 5 spawnparticlesource = "Orxonox/fairytwirl" … … 21 22 rotationThrust = 25 22 23 24 jumpBoost = 30 25 23 26 lift = 1; 24 27 stallSpeed = 220; … … 31 34 collisionType = "dynamic" 32 35 mass = 100 33 linearDamping = 0. 736 linearDamping = 0.2 34 37 angularDamping = 0.9999999 35 38 > … … 56 59 include("../includes/weaponSettingsPirate.oxi") 57 60 ?> 58 </ HoverShip>61 </SpaceShip> 59 62 </Template> 60 63 … … 70 73 </Template> 71 74 72 <Template name=spaceshiphoverengine baseclass= MultiStateEngine>75 <Template name=spaceshiphoverengine baseclass=Engine> 73 76 <MultiStateEngine 74 77 boostfactor = 2 -
code/branches/hoverHS15/src/modules/hover/HoverShip.cc
r10760 r10784 42 42 { 43 43 RegisterObject(HoverShip); 44 enableCollisionCallback(); 45 isFloor_ = false; 44 46 } 45 47 … … 49 51 } 50 52 51 /*void HoverShip::moveFrontBack(const Vector2& value)52 53 void HoverShip::moveFrontBack(const Vector2& value) 54 { this->steering_.z -= value.x; } 53 55 54 56 void HoverShip::moveRightLeft(const Vector2& value) … … 58 60 { this->steering_.y += value.x; } 59 61 60 void HoverShip::rotateYaw(const Vector2& value) {} 61 void HoverShip::rotatePitch(const Vector2& value) {} 62 void HoverShip::rotateRoll(const Vector2& value) {}*/ 62 void HoverShip::rotateYaw(const Vector2& value) 63 { 64 this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() + value.x); 65 66 Pawn::rotateYaw(value); 67 } 68 69 void HoverShip::XMLPort(Element& xmlelement, XMLPort::Mode mode) 70 { 71 SUPER(HoverShip, XMLPort, xmlelement, mode); 72 73 XMLPortParam(HoverShip, "jumpBoost", setJumpBoost, getJumpBoost, xmlelement, mode); 74 } 75 76 77 void HoverShip::setJumpBoost(float jumpBoost) 78 { 79 this->jumpBoost_ = jumpBoost; 80 } 81 82 83 float HoverShip::getJumpBoost() 84 { 85 return jumpBoost_; 86 } 87 88 /** 89 @brief 90 Rotate in pitch direction. 91 Due to added left, can also lead to an additional up-down motion. 92 @param value 93 A vector whose first component specifies the magnitude of the rotation. Positive means pitch up, negative means pitch down. 94 */ 95 void HoverShip::rotatePitch(const Vector2& value) { } 96 97 /** 98 @brief 99 Rotate in roll direction. 100 @param value 101 A vector whose first component specifies the magnitude of the rotation. Positive means roll left, negative means roll right. 102 */ 103 void HoverShip::rotateRoll(const Vector2& value) { } 63 104 64 105 bool HoverShip::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) 65 106 { 66 orxout() << "collision" << endl; 107 SpaceShip::collidesAgainst(otherObject, cs, contactPoint); 108 //SUPER(HoverShip, collidesAgainst, otherObject, cs, contactPoint); 67 109 68 /*if (contactPoint.m_normalWorldOnB.y() > 0.6) 110 if (contactPoint.m_normalWorldOnB.y() > 0.6 111 && this->getVelocity().y < 1) { 69 112 this->isFloor_ = true; 70 else113 } else { 71 114 this->isFloor_ = false; 115 } 72 116 73 return false;*/74 117 return false; 75 118 } 76 119 77 120 void HoverShip::boost(bool bBoost) { 78 /*if (this->isFloor_)121 if (bBoost && this->isFloor_) 79 122 { 80 if (!this->thisTickBoost_) 81 this->localVelocity_.y = jumpValue_; 82 //this->physicalBody_->applyCentralImpulse(btVector3(0, jumpvalue, 0)); 83 this->thisTickBoost_ = true; 123 this->setVelocity( 124 this->getVelocity().x, 125 jumpBoost_, 126 this->getVelocity().z 127 ); 84 128 this->isFloor_ = false; 85 } */129 } 86 130 } 87 131 88 /*Hover* HoverShip::getGame()132 /*Hover* HoverShip::getGame() 89 133 { 90 134 if (game == NULL) -
code/branches/hoverHS15/src/modules/hover/HoverShip.h
r10760 r10784 35 35 #define _HoverShip_H__ 36 36 37 #include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h> 37 38 38 39 #include "HoverPrereqs.h" … … 41 42 #include "worldentities/pawns/SpaceShip.h" 42 43 #include "graphics/Camera.h" 44 #include "core/class/Super.h" 43 45 44 46 #include "Hover.h" // Is necessary for getGame function … … 48 50 class _HoverExport HoverShip : public SpaceShip 49 51 { 52 private: 53 float jumpBoost_; 54 bool isFloor_; 55 50 56 public: 51 57 HoverShip(Context* context); … … 53 59 virtual void tick(float dt); 54 60 55 /*virtual void moveFrontBack(const Vector2& value); 61 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 62 63 virtual void setJumpBoost(float jumpBoost); 64 65 virtual float getJumpBoost(); 66 67 virtual void moveFrontBack(const Vector2& value); 56 68 57 69 virtual void moveRightLeft(const Vector2& value); … … 63 75 virtual void rotatePitch(const Vector2& value); 64 76 65 virtual void rotateRoll(const Vector2& value); */77 virtual void rotateRoll(const Vector2& value); 66 78 67 79 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
Note: See TracChangeset
for help on using the changeset viewer.