If I read you correctly, you need some way of animating between the pointing at current angle to pointing at a target angle. I was severely tempted to resort to vectors and dot products to solve this more elegantly, but as the questioner phrased the problem in terms of angles, I figured the solution had better be in terms of angles too.
The (simpler) vector approach is outlined in this answer to a similar question
Most of the code is figuring out whether to move the current angle clockwise(decreasing) or anti-clockwise (increasing). We need to figure out which direction is the shortest route to arrive at targetAngle. This is a simple check, except for the case where both angles are on opposite sides of the x-axis. The question becomes, whether it is shorter to move towards the positive-x-axis or negative-x-axis?
In the code below, making angleInc bigger or smaller will make the animation quicker or slower;
float currentRot; //current angle (direction) of entity
float targetRot; // angle entity SHOULD be at
float angInc=MathHelper.Pi/100.0f; //how much we should turn each frame (adjusts speed of animation)
public void Update(){
//first need to make sure that both angles are in the range -pi to +pi
//if they are outside the range, adjust them accordingly
if(currentRot>MathHelper.Pi) currentRot-=MathHelper.TwoPi;
if(targetRot>MathHelper.Pi) targetRot-=MathHelper.TwoPi;
if(currentRot<-MathHelper.Pi) currentRot=MathHelper.TwoPi-currentRot;
if(targetRot<-MathHelper.Pi) targetRot=MathHelper.TwoPi-targetRot;
//next figure out which direction we should be changing currentAngle
bool increasingAngle=false; this will be true if currentAngles needs to get bigger and vis-versa
//four cases to consider
//both angles are positive
if(currentAngle>=0 && targetAngle>=0){
if(currentAngle<targetAngle)
increasingAngle=true;
}
//both angles are negative
else if(currentAngle<0 && targetAngle<0){
if(currentAngle<targetAngle)
increasingAngle=true;
}
//both angles are on opposite sides of the x-axis
else{
if(Math.Abs(currentAngle-targetAngle)<MathHelper.Pi){// shorter to go via zero
if(currentAngle<0)
increasingAngle=true;
}
else{ // need to go via ±pi
if(currentAngle >0)
increasingAngle=true;
if(Math.Abs(currentRot-targetRot)< angleInc){// we've (almost) reached our target angle
currentRot=targetRot; //in case we are not *exactly* at the target angle
}
else{ //need to move currentAngle towards targetAngle
//direction to move has been calculated in the previous section
if(increasingAngle==true)
currentRot+=angInc;
else
currentRot-=angInc;
}
enityRotationMatrix=Matrix.CreateRotationY(currentRot);
}
}
EDIT fixed bugs mentioned in comments below