Changeset 12147 for code/branches/OrxoKart_HS18/src/modules/orxokart
- Timestamp:
- Dec 5, 2018, 11:25:23 AM (6 years ago)
- Location:
- code/branches/OrxoKart_HS18/src/modules/orxokart
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/OrxoKart_HS18/src/modules/orxokart/CMakeLists.txt
r12144 r12147 7 7 ShroomHUD.cc 8 8 TimeHUD.cc 9 KartController.cc 9 10 ) 10 11 -
code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartKart.cc
r12066 r12147 33 33 #include "core/CoreIncludes.h" 34 34 #include "core/XMLPort.h" 35 36 35 #include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h> 36 #include "controllers/HumanController.h" 37 37 38 38 namespace orxonox … … 42 42 OrxoKartKart::OrxoKartKart(Context* context) : SpaceShip(context) 43 43 { 44 44 45 RegisterObject(OrxoKartKart); 45 46 enableCollisionCallback(); 46 isFloor_ = false;47 jumpBoost_ = 0;48 47 } 49 48 50 49 void OrxoKartKart::moveFrontBack(const Vector2& value) 51 50 { 52 this->steering_.z -= value.x; 53 orxout() << "mFB" << endl;51 this->steering_.z -= value.x; 52 54 53 } 55 54 56 55 void OrxoKartKart::moveRightLeft(const Vector2& value) 57 { 56 { 58 57 this->rotateYaw(value); 59 orxout() << "mRL" << endl;60 58 } 61 59 … … 63 61 { 64 62 this->steering_.y += value.x; 65 orxout() << "mUD" << endl;63 66 64 } 67 65 68 66 void OrxoKartKart::rotateYaw(const Vector2& value) 69 67 { 70 this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() - value.x); 71 //orxout() << value; 72 Pawn::rotateYaw(value); 68 this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() - value.x); 73 69 } 74 70 75 71 void OrxoKartKart::XMLPort(Element& xmlelement, XMLPort::Mode mode) 76 { 77 SUPER(OrxoKartKart, XMLPort, xmlelement, mode); 72 { 73 SUPER(OrxoKartKart, XMLPort, xmlelement, mode); 74 75 } 78 76 79 XMLPortParam(OrxoKartKart, "jumpBoost", setJumpBoost, getJumpBoost, xmlelement, mode);80 }81 77 82 78 /** … … 94 90 void OrxoKartKart::rotateRoll(const Vector2& value) { } 95 91 96 /**97 @brief98 Checks if the ship is touching the floor. The ship can only jump if there is contact with someting beneath it.99 */100 bool OrxoKartKart::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)101 {102 SpaceShip::collidesAgainst(otherObject, cs, contactPoint);103 //SUPER(OrxoKartKart, collidesAgainst, otherObject, cs, contactPoint);104 92 105 if (contactPoint.m_normalWorldOnB.y() > 0.6106 && this->getVelocity().y < 1) {107 this->isFloor_ = true;108 } else {109 this->isFloor_ = false;110 }111 112 return false;113 }114 115 /**116 @brief117 Makes the ship jump118 @param bBoost119 */120 void OrxoKartKart::boost(bool bBoost) {121 if (bBoost && this->isFloor_)122 {123 this->setVelocity(124 this->getVelocity().x,125 jumpBoost_,126 this->getVelocity().z127 );128 this->isFloor_ = false;129 }130 }131 93 } -
code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartKart.h
r12066 r12147 46 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 47 47 48 /// sets this ships jumpBoost49 inline void setJumpBoost(float jumpBoost)50 { this->jumpBoost_ = jumpBoost; }51 /// returns this ships jumpBoost52 inline float getJumpBoost() const53 { return this->jumpBoost_; }54 55 48 virtual void moveFrontBack(const Vector2& value) override; 56 49 … … 64 57 65 58 virtual void rotateRoll(const Vector2& value) override; 66 67 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) override;68 69 virtual void boost(bool bBoost) override;70 71 private:72 float jumpBoost_;73 bool isFloor_;74 59 }; 75 60 }
Note: See TracChangeset
for help on using the changeset viewer.