Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6034 in orxonox.OLD for trunk/src/world_entities/space_ships


Ignore:
Timestamp:
Dec 10, 2005, 11:41:18 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the spaceshipcontroll branche back to the trunk
merged with command
svn merge branche/spaceshipcontroll trunk -r5978:HEAD
confilcs:
space_ship.cc: favor of controll, but Draw from trunk
rest: space_ship.h and sound_engine. in favor of the spaceshipcontroll branche

Location:
trunk/src/world_entities/space_ships
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/space_ships/space_ship.cc

    r6033 r6034  
    1111### File Specific:
    1212   main-programmer: Benjamin Knecht
    13    co-programmer: ...
     13   co-programmer: Silvan Nellen
    1414
    1515*/
     
    2020#include "space_ship.h"
    2121
     22#include "objModel.h"
    2223#include "resource_manager.h"
    2324
     
    111112  PRINTF(4)("SPACESHIP INIT\n");
    112113
    113   EventHandler::getInstance()->grabEvents(false);
     114  EventHandler::getInstance()->grabEvents(true);
    114115
    115116  bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false;
     
    117118  xMouse = yMouse = 0;
    118119  mouseSensitivity = 0.001;
     120  airViscosity = 1.0;
    119121
    120122  cycle = 0.0;
     
    253255void SpaceShip::tick (float time)
    254256{
    255      cycle += time;
     257
    256258  // spaceship controlled movement
    257259  this->calculateVelocity(time);
     
    259261  Vector move = (velocity)*time;
    260262
    261   //orient the spaceship model in the direction of movement.
     263  //orient the velocity in the direction of the spaceship.
     264  travelSpeed = velocity.len();
     265  velocity += ((this->getAbsDirX())*travelSpeed-velocity)*airViscosity;
     266  velocity = (velocity.getNormalized())*travelSpeed;
    262267
    263268  // this is the air friction (necessary for a smooth control)
    264269  if(velocity.len() != 0) velocity -= velocity*0.01;
    265270
     271  //hoover effect
     272  cycle += time;
    266273  this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02);
     274
     275  //readjust
     276 // if (this->getAbsDirZ().y > 0.1) this->shiftDir(Quaternion(time*0.3, Vector(1,0,0)));
     277  //else if (this->getAbsDirZ().y < -0.1) this->shiftDir(Quaternion(-time*0.3, Vector(1,0,0)));
    267278
    268279  //SDL_WarpMouse(GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2);
     
    299310   }
    300311
    301   if( this->bLeft /* > -this->getRelCoor().z*2*/)
     312  if( this->bLeft/* > -this->getRelCoor().z*2*/)
    302313  {
    303314    this->shiftDir(Quaternion(time, Vector(0,1,0)));
     
    316327    //rotVal += .4;
    317328  }
     329
    318330
    319331  if( this->bRollL /* > -this->getRelCoor().z*2*/)
  • trunk/src/world_entities/space_ships/space_ship.h

    r5996 r6034  
    1 
    21/*!
    32 * @file space_ship.h
     
    6968    float                 acceleration;       //!< the acceleration of the player.
    7069
     70    float                 airViscosity;
     71
    7172};
    7273
Note: See TracChangeset for help on using the changeset viewer.