Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 9, 2015, 2:09:38 PM (8 years ago)
Author:
bucyril
Message:

Finished hover ship control and resolved merge conflict
—this line, and those below, will be ignored—

M src/modules/hover/HoverShip.cc
M src/modules/hover/HoverShip.h
M data/levels/templates/spaceshipHover.oxt

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/hoverHS15/src/modules/hover/HoverShip.cc

    r10760 r10784  
    4242    {
    4343        RegisterObject(HoverShip);
     44        enableCollisionCallback();
     45        isFloor_ = false;
    4446    }
    4547
     
    4951    }
    5052
    51     /*void HoverShip::moveFrontBack(const Vector2& value)
    52                 { this->steering_.z -= value.x; }
     53    void HoverShip::moveFrontBack(const Vector2& value)
     54        { this->steering_.z -= value.x; }
    5355
    5456    void HoverShip::moveRightLeft(const Vector2& value)
     
    5860        { this->steering_.y += value.x; }
    5961
    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) { }
    63104
    64105    bool HoverShip::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
    65106    {
    66         orxout() << "collision" << endl;
     107        SpaceShip::collidesAgainst(otherObject, cs, contactPoint);
     108        //SUPER(HoverShip, collidesAgainst, otherObject, cs, contactPoint);
    67109
    68         /*if (contactPoint.m_normalWorldOnB.y() > 0.6)
     110        if (contactPoint.m_normalWorldOnB.y() > 0.6
     111            && this->getVelocity().y < 1) {
    69112            this->isFloor_ = true;
    70         else
     113        } else {
    71114            this->isFloor_ = false;
     115        }
    72116
    73         return false;*/
    74117        return false;
    75118    }
    76119
    77120    void HoverShip::boost(bool bBoost) {
    78         /*if (this->isFloor_)
     121        if (bBoost && this->isFloor_)
    79122        {
    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                );
    84128            this->isFloor_ = false;
    85         }*/
     129        }
    86130    }
    87131
    88    /* Hover* HoverShip::getGame()
     132    /*Hover* HoverShip::getGame()
    89133    {
    90134        if (game == NULL)
Note: See TracChangeset for help on using the changeset viewer.