| Last change
                  on this file since 7209 was
                  6222,
                  checked in by bensch, 20 years ago | 
        
          | 
orxonox/trunk: merged the christmas branche to the trunkmerged with command:
 svn merge -r6165:HEAD christmas_branche/ ../trunk/
 no conflicts
 
 | 
        | File size:
            1.2 KB | 
      
      
        
  | Line |  | 
|---|
| 1 |  | 
|---|
| 2 |  | 
|---|
| 3 | /* | 
|---|
| 4 | orxonox - the future of 3D-vertical-scrollers | 
|---|
| 5 |  | 
|---|
| 6 | Copyright (C) 2004 orx | 
|---|
| 7 |  | 
|---|
| 8 | This program is free software; you can redistribute it and/or modify | 
|---|
| 9 | it under the terms of the GNU General Public License as published by | 
|---|
| 10 | the Free Software Foundation; either version 2, or (at your option) | 
|---|
| 11 | any later version. | 
|---|
| 12 |  | 
|---|
| 13 | ### File Specific: | 
|---|
| 14 | main-programmer: Patrick Boenzli | 
|---|
| 15 | co-programmer: | 
|---|
| 16 | */ | 
|---|
| 17 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY | 
|---|
| 18 |  | 
|---|
| 19 |  | 
|---|
| 20 | #include "satellite.h" | 
|---|
| 21 |  | 
|---|
| 22 | #include "objModel.h" | 
|---|
| 23 | #include "vector.h" | 
|---|
| 24 |  | 
|---|
| 25 |  | 
|---|
| 26 | using namespace std; | 
|---|
| 27 |  | 
|---|
| 28 | /** | 
|---|
| 29 | *  standard constructor | 
|---|
| 30 | */ | 
|---|
| 31 | Satellite::Satellite (Vector axis, float speed) | 
|---|
| 32 | { | 
|---|
| 33 | this->setClassID(CL_SATELLITE, "Satellite"); | 
|---|
| 34 |  | 
|---|
| 35 | this->loadModel("cube"); | 
|---|
| 36 | this->speed = speed; | 
|---|
| 37 | this->axis = new Vector(); | 
|---|
| 38 | *this->axis = axis; | 
|---|
| 39 | } | 
|---|
| 40 |  | 
|---|
| 41 | /** | 
|---|
| 42 | *  standard destructor | 
|---|
| 43 | */ | 
|---|
| 44 | Satellite::~Satellite () | 
|---|
| 45 | { | 
|---|
| 46 | } | 
|---|
| 47 |  | 
|---|
| 48 |  | 
|---|
| 49 | /** | 
|---|
| 50 | *  this method is called every frame | 
|---|
| 51 | * @param time: the time in seconds that has passed since the last tick | 
|---|
| 52 |  | 
|---|
| 53 | Handle all stuff that should update with time inside this method (movement, animation, etc.) | 
|---|
| 54 | */ | 
|---|
| 55 | void Satellite::tick(float time) | 
|---|
| 56 | { | 
|---|
| 57 | float w = this->speed * M_PI; | 
|---|
| 58 |  | 
|---|
| 59 | Quaternion rotation(w * time, *this->axis); | 
|---|
| 60 | Quaternion v = this->getRelDir(); | 
|---|
| 61 |  | 
|---|
| 62 | this->setRelDir(v * rotation); | 
|---|
| 63 | } | 
|---|
| 64 |  | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.