04-29-2015, 05:55 AM
(This post was last modified: 04-29-2015, 06:00 AM by LogicParrot.)
I have already tested flight, it works with the current pathFinder with a different flag.
It's all awesome except the current AI, I just feel it downgraded my Pathfinder by an order of magnitude, it won't follow side-by-side points without trouble, and sometimes the mobs just get stuck. I am sure it has nothing to do with the PathFinder because it only manipulates m_Destination. It's just that the AI is not good at reaching m_Destination even if it's a single block away.
This seems to be the code block responsible for m_Destination following (and hence responsible for the trouble):
Anyone knows how could that be improved?
It's all awesome except the current AI, I just feel it downgraded my Pathfinder by an order of magnitude, it won't follow side-by-side points without trouble, and sometimes the mobs just get stuck. I am sure it has nothing to do with the PathFinder because it only manipulates m_Destination. It's just that the AI is not good at reaching m_Destination even if it's a single block away.
This seems to be the code block responsible for m_Destination following (and hence responsible for the trouble):
Code:
if (m_Destination != GetPosition())
{
Distance.y = 0;
Distance.Normalize();
if (m_bOnGround)
{
Distance *= 2.5f;
}
else if (IsSwimming())
{
Distance *= 1.3f;
}
else
{
// Don't let the mob move too much if he's falling.
Distance *= 0.25f;
}
// Apply walk speed:
Distance *= m_RelativeWalkSpeed;
AddSpeedX(Distance.x);
AddSpeedZ(Distance.z);
}