Hi, I have somthing like this:
public void TouchByLight(Light3D light)
{
if (State != EnemyState.ESCAPE)
{
State = EnemyState.ESCAPE;
Vector3 direction = new Vector3(
light.GlobalTransform.origin.x - GlobalTransform.origin.x,
0f,
light.GlobalTransform.origin.z - GlobalTransform.origin.z
).Normalized();
Target = GlobalTransform.origin + direction * ESCAPE_DISTANCE;
}
}
This should work as you say, but the AI run to a random direction in this case, have you any Idea of what I could doing wrong here?