Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 2, 2015, 6:01:56 PM (9 years ago)
Author:
fvultier
Message:

2 problems fixed: The collidesAgainst function in the hovership get now properly called. The Hoverhalls have a collisionShape that works.

Location:
code/branches/hoverHS15
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/hoverHS15/data/levels/Hover.oxw

    r10751 r10760  
    1414<?lua
    1515  include("templates/spaceshipPirate.oxt")
     16  include("templates/spaceshipHover.oxt")
    1617?>
    1718
     
    7576   
    7677    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
    77     <SpawnPoint team=0 position="0,100,0" lookat="100,100,0" spawnclass=SpaceShip pawndesign=spaceshippirate />
     78    <SpawnPoint team=0 position="0,100,0" lookat="100,100,0" spawnclass=HoverShip pawndesign=spaceshiphover />
    7879   
    7980  </Scene>
  • code/branches/hoverHS15/src/modules/hover/Hover.cc

    r10751 r10760  
    5656        SUPER(Hover, tick, dt);
    5757
    58         if(firstTick){
     58        if(firstTick)
     59        {
    5960            firstTick = false;
    6061            new HoverWall(origin_->getContext(), 1, 2);
     62            new HoverWall(origin_->getContext(), 2, 6);
    6163        }     
    6264
  • code/branches/hoverHS15/src/modules/hover/HoverShip.cc

    r10694 r10760  
    4949    }
    5050
    51     void HoverShip::moveFrontBack(const Vector2& value)
     51    /*void HoverShip::moveFrontBack(const Vector2& value)
    5252                { this->steering_.z -= value.x; }
    5353
     
    6060    void HoverShip::rotateYaw(const Vector2& value) {}
    6161    void HoverShip::rotatePitch(const Vector2& value) {}
    62     void HoverShip::rotateRoll(const Vector2& value) {}
     62    void HoverShip::rotateRoll(const Vector2& value) {}*/
    6363
    64     bool HoverShip::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
     64    bool HoverShip::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
    6565    {
     66        orxout() << "collision" << endl;
     67
    6668        /*if (contactPoint.m_normalWorldOnB.y() > 0.6)
    6769            this->isFloor_ = true;
  • code/branches/hoverHS15/src/modules/hover/HoverShip.h

    r10694 r10760  
    5353            virtual void tick(float dt);
    5454
    55                     virtual void moveFrontBack(const Vector2& value);
     55                    /*virtual void moveFrontBack(const Vector2& value);
    5656
    5757                    virtual void moveRightLeft(const Vector2& value);
     
    6363                    virtual void rotatePitch(const Vector2& value);
    6464                   
    65                     virtual void rotateRoll(const Vector2& value);
     65                    virtual void rotateRoll(const Vector2& value);*/
    6666
    67                     virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
     67                    virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
    6868
    6969                    virtual void boost(bool bBoost);
  • code/branches/hoverHS15/src/modules/hover/HoverWall.cc

    r10751 r10760  
    5050    {
    5151        RegisterObject(HoverWall);
    52         model_ = new Model(context);
    53         cs_ = new BoxCollisionShape(context);
    54         model_->setMeshSource("cube.mesh");
    55         model_->setScale3D(Vector3(100, 30, 2));
    56         model_->setPosition(Vector3(100,0,100));
    57         cs_->setPosition(Vector3(100,0,100));
    58         cs_->setHalfExtents(Vector3(100, 30, 2));
    59 
    60 
    61 
     52        model_ = NULL;
     53        cs_ = NULL;
    6254    }
    6355
     
    6557    {
    6658        RegisterObject(HoverWall);
     59
    6760        model_ = new Model(context);
     61        model_->setMeshSource("cube.mesh");
     62        model_->setScale3D(Vector3(100, 30, 2));
     63        model_->setPosition(Vector3(x*100-50,0,y*100-50));
     64
     65        this->attach(model_);
     66
     67        this->enableCollisionCallback();
     68        this->setCollisionResponse(true);
     69        this->setCollisionType(Static);
     70
    6871        cs_ = new BoxCollisionShape(context);
    69         model_->setMeshSource("cube.mesh");
    70         model_->setScale3D(Vector3(50, 30, 2));
    71         model_->setPosition(Vector3(x*100-50,0,y*100-50));
     72        cs_->setHalfExtents(Vector3(100, 30, 2));
    7273        cs_->setPosition(Vector3(x*100-50,0,y*100-50));
    73         cs_->setHalfExtents(Vector3(50, 30, 2));
    7474
    75 
    76 
     75        this->attachCollisionShape(cs_);
    7776    }
    7877
  • code/branches/hoverHS15/src/modules/invader/InvaderShip.cc

    r10624 r10760  
    139139        isFireing = bBoost;
    140140    }
    141     inline bool InvaderShip::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
     141    inline bool InvaderShip::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
    142142    {
    143143        // orxout() << "touch!!! " << endl; //<< otherObject << " at " << contactPoint;
  • code/branches/hoverHS15/src/modules/invader/InvaderShip.h

    r10624 r10760  
    6565            virtual void updateLevel();
    6666
    67             virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
     67            virtual inline bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
    6868
    6969        protected:
Note: See TracChangeset for help on using the changeset viewer.