Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10784


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

Location:
code/branches/hoverHS15
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/hoverHS15/data/levels/templates/spaceshipHover.oxt

    r10760 r10784  
    11<Template name=spaceshiphover>
    2   <HoverShip
     2  <SpaceShip
     3   hudtemplate            = spaceshiphud
    34   camerapositiontemplate = spaceshiphovercameras
    45   spawnparticlesource    = "Orxonox/fairytwirl"
     
    2122   rotationThrust    = 25
    2223
     24   jumpBoost = 30
     25
    2326   lift = 1;
    2427   stallSpeed = 220;
     
    3134   collisionType     = "dynamic"
    3235   mass              = 100
    33    linearDamping     = 0.7
     36   linearDamping     = 0.2
    3437   angularDamping    = 0.9999999
    3538  >
     
    5659  include("../includes/weaponSettingsPirate.oxi")
    5760?>
    58   </HoverShip>
     61  </SpaceShip>
    5962</Template>
    6063
     
    7073</Template>
    7174
    72 <Template name=spaceshiphoverengine baseclass=MultiStateEngine>
     75<Template name=spaceshiphoverengine baseclass=Engine>
    7376  <MultiStateEngine
    7477   boostfactor    = 2
  • 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)
  • code/branches/hoverHS15/src/modules/hover/HoverShip.h

    r10760 r10784  
    3535#define _HoverShip_H__
    3636
     37#include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h>
    3738
    3839#include "HoverPrereqs.h"
     
    4142#include "worldentities/pawns/SpaceShip.h"
    4243#include "graphics/Camera.h"
     44#include "core/class/Super.h"
    4345
    4446#include "Hover.h" // Is necessary for getGame function
     
    4850    class _HoverExport HoverShip : public SpaceShip
    4951    {
     52    private:
     53        float jumpBoost_;
     54        bool isFloor_;
     55
    5056        public:
    5157            HoverShip(Context* context);
     
    5359            virtual void tick(float dt);
    5460
    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);
    5668
    5769                    virtual void moveRightLeft(const Vector2& value);
     
    6375                    virtual void rotatePitch(const Vector2& value);
    6476                   
    65                     virtual void rotateRoll(const Vector2& value);*/
     77                    virtual void rotateRoll(const Vector2& value);
    6678
    6779                    virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
Note: See TracChangeset for help on using the changeset viewer.