Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 21, 2009, 12:33:37 AM (15 years ago)
Author:
scheusso
Message:

made some changes in NewHumanController, Pawn, CE, Controller and WeaponMode preparing the synchronisation of clients target and aimPosition

Location:
code/branches/presentation2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2

  • code/branches/presentation2/src/orxonox/weaponsystem/WeaponMode.cc

    r6108 r6111  
    202202            this->muzzlePosition_ = this->weapon_->getWorldPosition() + this->weapon_->getWorldOrientation() * this->muzzleOffset_;
    203203
    204             Controller* controller = this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getController();
    205             if (controller->canFindTarget())
    206             {
    207                 Vector3 muzzleDirection(controller->getTarget() - this->muzzlePosition_);
    208                 this->muzzleOrientation_ = (this->weapon_->getWorldOrientation() * WorldEntity::FRONT).getRotationTo(muzzleDirection) * this->weapon_->getWorldOrientation();
     204            Pawn* pawn = this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn();
     205            Vector3 muzzleDirection;
     206            if ( pawn->getTarget() )
     207            {
     208                muzzleDirection = pawn->getTarget()->getWorldPosition() - this->muzzlePosition_;
    209209            }
    210210            else
    211                 this->muzzleOrientation_ = this->weapon_->getWorldOrientation();
     211                muzzleDirection = pawn->getAimPosition() - this->muzzlePosition_;
     212//             COUT(0) << "muzzleDirection " << muzzleDirection << endl;
     213                //this->muzzleOrientation_ = this->weapon_->getWorldOrientation();
     214            this->muzzleOrientation_ = (this->weapon_->getWorldOrientation() * WorldEntity::FRONT).getRotationTo(muzzleDirection) * this->weapon_->getWorldOrientation();
    212215        }
    213216        else
Note: See TracChangeset for help on using the changeset viewer.