Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 5, 2018, 11:25:23 AM (5 years ago)
Author:
emustafa
Message:

controlls tweaks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartKart.cc

    r12066 r12147  
    3333#include "core/CoreIncludes.h"
    3434#include "core/XMLPort.h"
    35 
    3635#include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h>
     36#include "controllers/HumanController.h"
    3737
    3838namespace orxonox
     
    4242    OrxoKartKart::OrxoKartKart(Context* context) : SpaceShip(context)
    4343    {
     44
    4445        RegisterObject(OrxoKartKart);
    4546        enableCollisionCallback();
    46         isFloor_ = false;
    47         jumpBoost_ = 0;
    4847    }
    4948
    5049    void OrxoKartKart::moveFrontBack(const Vector2& value)
    5150        {
    52             this->steering_.z -= value.x; 
    53             orxout() << "mFB" << endl;
     51            this->steering_.z -= value.x;
     52           
    5453        }
    5554
    5655    void OrxoKartKart::moveRightLeft(const Vector2& value)
    57         {
     56        {  
    5857            this->rotateYaw(value);
    59             orxout() << "mRL" << endl;
    6058        }
    6159
     
    6361        {
    6462            this->steering_.y += value.x;
    65             orxout() << "mUD" << endl;
     63           
    6664        }
    6765
    6866    void OrxoKartKart::rotateYaw(const Vector2& value)
    6967        {
    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); 
    7369        }
    7470
    7571    void OrxoKartKart::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    76     {
    77         SUPER(OrxoKartKart, XMLPort, xmlelement, mode);
     72        {
     73            SUPER(OrxoKartKart, XMLPort, xmlelement, mode);
     74           
     75        }
    7876
    79         XMLPortParam(OrxoKartKart, "jumpBoost", setJumpBoost, getJumpBoost, xmlelement, mode);
    80     }
    8177
    8278    /**
     
    9490    void OrxoKartKart::rotateRoll(const Vector2& value) { }
    9591
    96     /**
    97     @brief
    98         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);
    10492
    105         if (contactPoint.m_normalWorldOnB.y() > 0.6
    106             && this->getVelocity().y < 1) {
    107             this->isFloor_ = true;
    108         } else {
    109             this->isFloor_ = false;
    110         }
    111 
    112         return false;
    113     }
    114 
    115     /**
    116     @brief
    117         Makes the ship jump
    118     @param bBoost
    119     */
    120     void OrxoKartKart::boost(bool bBoost) {
    121         if (bBoost && this->isFloor_)
    122         {
    123             this->setVelocity(
    124                 this->getVelocity().x,
    125                 jumpBoost_,
    126                 this->getVelocity().z
    127                 );
    128             this->isFloor_ = false;
    129         }
    130     }
    13193}
Note: See TracChangeset for help on using the changeset viewer.