Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 644


Ignore:
Timestamp:
Dec 19, 2007, 3:03:30 AM (16 years ago)
Author:
landauf
Message:

added free-view-mode (hold right mouse button pressed)

Location:
code/branches/FICN/src/orxonox/objects
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/orxonox/objects/Projectile.cc

    r643 r644  
    2424            this->setOrientation(this->owner_->getOrientation());
    2525            this->setPosition(this->owner_->getPosition());
     26            this->translate(Vector3(55, 0, 0), Ogre::Node::TS_LOCAL);
    2627            this->setVelocity(Vector3(1, 0, 0) * this->speed_);
    2728        }
  • code/branches/FICN/src/orxonox/objects/SpaceShip.cc

    r643 r644  
    4949
    5050        this->setMouseEventCallback_ = false;
    51         this->bMousePressed_ = false;
     51        this->bLMousePressed_ = false;
     52        this->bRMousePressed_ = false;
     53
     54        this->camNode_ = 0;
    5255
    5356        this->tt_ = 0;
     
    140143        this->greenBillboard_.setBillboardSet("Examples/Flare", ColourValue(0.0, 1.0, 0.0), 1);
    141144
    142         this->redNode_ = this->getNode()->createChildSceneNode(this->getName() + "red", Vector3(0.1, 4.6, -0.3));
     145        this->redNode_ = this->getNode()->createChildSceneNode(this->getName() + "red", Vector3(0.3, 4.7, -0.3));
    143146        this->redNode_->setInheritScale(false);
    144         this->greenNode_ = this->getNode()->createChildSceneNode(this->getName() + "green", Vector3(0.1, -4.6, -0.3));
     147        this->greenNode_ = this->getNode()->createChildSceneNode(this->getName() + "green", Vector3(0.3, -4.7, -0.3));
    145148        this->greenNode_->setInheritScale(false);
    146149
     
    171174        {
    172175            Ogre::Camera *cam = Orxonox::getSingleton()->getSceneManager()->createCamera("ShipCam");
    173             Ogre::SceneNode *node = this->getNode()->createChildSceneNode("CamNode");
     176            this->camNode_ = this->getNode()->createChildSceneNode("CamNode");
    174177/*
    175178//            node->setInheritOrientation(false);
     
    184187            cam->roll(Degree(-90));
    185188
    186             node->attachObject(cam);
     189            this->camNode_->attachObject(cam);
    187190            Orxonox::getSingleton()->getOgrePointer()->getRoot()->getAutoCreatedWindow()->addViewport(cam);
    188191        }
     
    203206        this->moved = true;
    204207
     208        if (this->bRMousePressed_)
     209        {
     210            this->camNode_->roll(Degree(-e.state.X.rel * 0.10));
     211            this->camNode_->yaw(Degree(e.state.Y.rel * 0.10));
     212        }
     213
    205214        return true;
    206215    }
     
    208217    bool SpaceShip::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id)
    209218    {
    210         this->bMousePressed_ = true;
     219        if (id == OIS::MB_Left)
     220            this->bLMousePressed_ = true;
     221        else if (id == OIS::MB_Right)
     222            this->bRMousePressed_ = true;
    211223
    212224        return true;
     
    215227    bool SpaceShip::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id)
    216228    {
    217         this->bMousePressed_ = false;
     229        if (id == OIS::MB_Left)
     230            this->bLMousePressed_ = false;
     231        else if (id == OIS::MB_Right)
     232        {
     233            this->bRMousePressed_ = false;
     234            this->camNode_->resetOrientation();
     235        }
     236
     237        return true;
    218238    }
    219239
     
    245265            this->timeToReload_ = 0;
    246266
    247         if (this->bMousePressed_ && this->timeToReload_ <= 0)
     267        if (this->bLMousePressed_ && this->timeToReload_ <= 0)
    248268        {
    249269            Projectile* proj = new Projectile(this);
  • code/branches/FICN/src/orxonox/objects/SpaceShip.h

    r643 r644  
    4343            bool bInvertMouse_;
    4444            bool setMouseEventCallback_;
    45             bool bMousePressed_;
     45            bool bLMousePressed_;
     46            bool bRMousePressed_;
     47
     48            Ogre::SceneNode* camNode_;
    4649
    4750            particle::ParticleInterface *tt_;
Note: See TracChangeset for help on using the changeset viewer.