Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 1, 2007, 7:48:48 PM (16 years ago)
Author:
rgrieder
Message:

RunManager.cpp completely commented in Doxygen style.
One or two comments are yet inappropriate since a few changes to the code have to be made anyway. coming soon.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/main_reto/src/OrxonoxShip.cpp

    r136 r141  
     1/*
     2 *   ORXONOX - the hottest 3D action shooter ever to exist
     3 *
     4 *
     5 *   License notice:
     6 *
     7 *   This program is free software: you can redistribute it and/or modify
     8 *   it under the terms of the GNU General Public License as published by
     9 *   the Free Software Foundation, either version 3 of the License, or
     10 *   (at your option) any later version.
     11 *
     12 *   This program is distributed in the hope that it will be useful,
     13 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 *   GNU General Public License for more details.
     16 *
     17 *   You should have received a copy of the GNU General Public License
     18 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
     19 *
     20 *
     21 *   Author:
     22 *      Reto Grieder
     23 *   Co-authors:
     24 *      ...
     25 *
     26 */
     27
    128#include "OrxonoxShip.h"
    229
    330
    431OrxonoxShip::OrxonoxShip(SceneManager *mSceneMgr, SceneNode *mNode)
    5         : mSceneMgr(mSceneMgr), mRootNode(mNode), speed(Vector3(0, 0, 0)), baseThrust(1000), thrust(0), sideThrust(0), n(0),
     32            : mSceneMgr(mSceneMgr), mRootNode(mNode), speed(Vector3(0, 0, 0)),
     33      baseThrust(1000), thrust(0), sideThrust(0), n(0),
    634        bulletSpeed(400)
    735{
     
    1644bool OrxonoxShip::initialise()
    1745{
    18         // load all the resources needed (no resource groups yet, so the allInit is not executed!)
    19         //ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
     46        // load all the resources needed (no resource groups yet,
     47  // so the allInit is not executed!)
     48        // ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
    2049
    2150        // create the "space ship" (currently a fish..)
     
    6493{
    6594        // TODO: Names must be unique!
    66         SceneNode *temp = mRootNode->getParentSceneNode()->createChildSceneNode("BulletNode" + StringConverter::toString(n));
     95        SceneNode *temp = mRootNode->getParentSceneNode()->createChildSceneNode(
     96        "BulletNode" + StringConverter::toString(n));
    6797        temp->setOrientation(mRootNode->getOrientation());
    6898        temp->setPosition(mRootNode->getPosition());
    6999        temp->setScale(Vector3(1, 1, 1) * 10);
    70100        temp->yaw(Degree(-90));
    71         return new Bullet(temp,
    72                 mSceneMgr->createEntity("bullet" + StringConverter::toString(n++), "Barrel.mesh"),
    73                 speed + (mRootNode->getLocalAxes() * Vector3(0, 0, -1)).normalisedCopy() * bulletSpeed);
     101        return new Bullet(temp, mSceneMgr->createEntity("bullet"
     102        + StringConverter::toString(n++), "Barrel.mesh"), speed
     103        + (mRootNode->getLocalAxes() * Vector3(0, 0, -1)).normalisedCopy()
     104        * bulletSpeed);
    74105}
    75106
    76 bool OrxonoxShip::tick(unsigned long time, float deltaTime)
     107bool OrxonoxShip::tick(unsigned long time, Real deltaTime)
    77108{
    78         speed += (mRootNode->getLocalAxes() * Vector3(0, 0, -1)).normalisedCopy() * thrust * deltaTime;
    79         speed += (mRootNode->getLocalAxes() * Vector3(-1, 0,  0)).normalisedCopy() * sideThrust * deltaTime;
     109  Quaternion quad = mRootNode->getOrientation();
     110  quad.normalise();
     111  speed += quad * Vector3(0, 0, -1) * thrust * deltaTime;
     112        speed += quad * Vector3(-1, 0,  0) * sideThrust * deltaTime;
    80113
    81114        mRootNode->translate(speed * deltaTime);
Note: See TracChangeset for help on using the changeset viewer.