Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4969 in orxonox.OLD


Ignore:
Timestamp:
Aug 4, 2005, 11:19:29 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: ability to set a Slots Direction

Location:
orxonox/trunk/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/sound/ogg_player.h

    r4961 r4969  
    1919
    2020
    21 #define BUFFER_SIZE (4096 * 4)
     21#define BUFFER_SIZE (16384 * 4)
    2222
    2323
  • orxonox/trunk/src/story_entities/world.cc

    r4968 r4969  
    440440  // bind camera
    441441  //this->localCamera->bind (localPlayer);
    442   this->localPlayer->addChild (this->localCamera);
     442 // this->localPlayer->addChild (this->localCamera);
    443443
    444444
     
    963963
    964964  SoundEngine::getInstance()->update();
    965  // music->update();
     965  music->update();
    966966}
    967967
  • orxonox/trunk/src/util/fast_factory.h

    r4950 r4969  
    2222
    2323#include "base_object.h"
    24 
    2524/**
    2625 * Creates a FastFactory to a Createable FastFactory.
  • orxonox/trunk/src/world_entities/player.cc

    r4967 r4969  
    8787
    8888  Weapon* turret = new Turret(this->weaponMan);
     89  Weapon* turret2 = new Turret(this->weaponMan);
    8990  this->weaponMan->addWeapon(wpLeft, 1, 0);
    9091  this->weaponMan->addWeapon(wpRight,1 ,1);
    9192  this->weaponMan->addWeapon(turret, 2, 2);
    92   this->weaponMan->addWeapon(turret, 3, 2);
     93  this->weaponMan->addWeapon(turret2, 2, 3);
    9394  this->weaponMan->addWeapon(wpLeft, 3, 0);
    9495  this->weaponMan->addWeapon(wpRight,3 ,1);
     
    113114
    114115  this->weaponMan = new WeaponManager(this);
    115   this->weaponMan->setSlotCount(3);
     116  this->weaponMan->setSlotCount(4);
    116117  this->weaponMan->setSlotPosition(0, Vector(-2.6, .1, -3.0));
    117118  this->weaponMan->setSlotPosition(1, Vector(-2.6, .1, 3.0));
    118   this->weaponMan->setSlotPosition(2, Vector(-1.5, .5, 0));
     119  this->weaponMan->setSlotPosition(2, Vector(-1.5, .5, -.5));
     120  this->weaponMan->setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0)));
     121  this->weaponMan->setSlotPosition(3, Vector(-1.5, .5, .5));
     122  this->weaponMan->setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0)));
    119123}
    120124
  • orxonox/trunk/src/world_entities/weapons/test_bullet.cc

    r4948 r4969  
    4040  this->energyMin = 1;
    4141  this->energyMax = 10;
     42  this->remove();
    4243}
    4344
  • orxonox/trunk/src/world_entities/weapons/turret.cc

    r4967 r4969  
    4242  this->setClassID(CL_TURRET, "Turret");
    4343
    44   this->model = (Model*)ResourceManager::getInstance()->load("models/turret1.obj", OBJ, RP_CAMPAIGN);
     44  this->loadModel("models/turret1.obj");
    4545
    4646  Animation3D* animation1 = this->getAnimation(WS_ACTIVATING, this);
     
    9595  Vector direction = this->getWeaponManager()->getFixedTarget()->getAbsCoor() - this->getAbsCoor();
    9696  direction.normalize();
    97   Quaternion quat = Quaternion(direction, this->getParent()->getAbsDir().apply(Vector(0,1,0))) * Quaternion ( -M_PI_2, Vector(0,1,0)) ;
    98 
    99   this->setAbsDir(quat);
     97  if (likely (this->getParent() != NULL))
     98  {
     99    Quaternion quat = Quaternion(direction, this->getParent()->getAbsDir().apply(Vector(0,1,0))) * Quaternion ( -M_PI_2, Vector(0,1,0)) ;
     100    this->setAbsDir(quat);
     101  }
     102  else
     103  {
     104    Quaternion quat = Quaternion(direction, this->getAbsDir().apply(Vector(0,1,0))) * Quaternion ( -M_PI_2, Vector(0,1,0)) ;
     105    this->setAbsDir(quat);
     106  }
    100107}
    101108
    102 /**
    103  *  fires the weapon
    104 
    105    this is called from the player.cc, when fire-button is been pushed
    106 */
    107109void Turret::fire()
    108110{
     
    126128
    127129
    128 /**
    129  *  is called, when the weapon is destroyed
    130 
    131    this is in conjunction with the hit function, so when a weapon is able to get
    132    hit, it can also be destoryed.
    133 */
    134130void Turret::destroy ()
    135131{}
    136132
    137133/**
    138  *  this will draw the weapon
     134 * draws the Turret
    139135*/
    140136void Turret::draw ()
  • orxonox/trunk/src/world_entities/weapons/weapon_manager.cc

    r4959 r4969  
    161161    this->currentSlotConfig[slot].position.setRelCoor(position);
    162162}
     163
     164void WeaponManager::setSlotDirection(int slot, const Quaternion& rotation)
     165{
     166  if (slot < this->slotCount)
     167    this->currentSlotConfig[slot].position.setRelDir(rotation);
     168}
     169
    163170
    164171/**
  • orxonox/trunk/src/world_entities/weapons/weapon_manager.h

    r4964 r4969  
    5757    // setting up the WeaponManager with the following functions
    5858    void setSlotPosition(int slot, const Vector& position);
     59    void setSlotDirection(int slot, const Quaternion& rotation);
    5960    /** @param slot the slot to get the relative position from @returns the relative position of the Carrier to the Slot */
    6061    const Vector& getSlotPosition(int slot) const { return this->currentSlotConfig[slot].position.getRelCoor(); };
Note: See TracChangeset for help on using the changeset viewer.