Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 13, 2017, 11:32:26 AM (8 years ago)
Author:
vyang
Message:

Kommentare

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DWeapon.cc

    r11668 r11669  
    9191        model->setScale(5);
    9292
    93         this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
     93        //get position and orientation of the ship to know in which direction the projectile needs to fire off
     94        Pawn* player = this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn();
    9495
    95         projectile->setOrientation(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getOrientation());
    96         projectile->setPosition(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getPosition());
     96        projectile->setOrientation(player->getOrientation());
     97        projectile->setPosition(player->getPosition());
    9798
    98         //auf 2D Ebene druecken
    99         Vector3 muzzle2D = this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getOrientation()* WorldEntity::FRONT;
     99        //Velocity & position of the projectile must be y = 0 since the game takes place in the x-z plane
     100        Vector3 muzzle2D = player->getOrientation()* WorldEntity::FRONT ;
    100101        muzzle2D.y = 0;
    101 
    102102        projectile->setVelocity(muzzle2D * this->speed_);
    103103
Note: See TracChangeset for help on using the changeset viewer.