Changeset 6111 for code/branches/presentation2/src/orxonox/weaponsystem
- Timestamp:
- Nov 21, 2009, 12:33:37 AM (15 years ago)
- Location:
- code/branches/presentation2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2
- Property svn:mergeinfo changed
/code/branches/particles2 merged: 6109
- Property svn:mergeinfo changed
-
code/branches/presentation2/src/orxonox/weaponsystem/WeaponMode.cc
r6108 r6111 202 202 this->muzzlePosition_ = this->weapon_->getWorldPosition() + this->weapon_->getWorldOrientation() * this->muzzleOffset_; 203 203 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_; 209 209 } 210 210 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(); 212 215 } 213 216 else
Note: See TracChangeset
for help on using the changeset viewer.