Skip to content

Commit

Permalink
Merge pull request #1657 from John3/fixAimOffset
Browse files Browse the repository at this point in the history
Correct AIPlayer aim.
  • Loading branch information
Areloch committed Jul 4, 2016
2 parents 95c0bcd + 9dadd28 commit fd7f8e5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Engine/source/T3D/aiPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,30 @@ void AIPlayer::clearAim()
mAimOffset = Point3F(0.0f, 0.0f, 0.0f);
}

/**
* Sets the correct aim for the bot to the target
*/
void AIPlayer::getMuzzleVector(U32 imageSlot,VectorF* vec)
{
MatrixF mat;
getMuzzleTransform(imageSlot,&mat);

MountedImage& image = mMountedImageList[imageSlot];

if (image.dataBlock->correctMuzzleVector)
{
disableHeadZCalc();
if (getCorrectedAim(mat, vec))
{
enableHeadZCalc();
return;
}
enableHeadZCalc();

}
mat.getColumn(1,vec);
}

/**
* Set the state of a movement trigger.
*
Expand Down
1 change: 1 addition & 0 deletions Engine/source/T3D/aiPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class AIPlayer : public Player {
void setAimLocation( const Point3F &location );
Point3F getAimLocation() const { return mAimLocation; }
void clearAim();
void AIPlayer::getMuzzleVector(U32 imageSlot,VectorF* vec);
bool checkInLos(GameBase* target = NULL, bool _useMuzzle = false, bool _checkEnabled = false);
bool checkInFoV(GameBase* target = NULL, F32 camFov = 45.0f, bool _checkEnabled = false);
F32 getTargetDistance(GameBase* target, bool _checkEnabled);
Expand Down

0 comments on commit fd7f8e5

Please sign in to comment.