I have an agent (archer) that I want to follow the path with an end reached distance of 0.2, but when it gets in range of the attack target, I want it to stop further away (40.0). I’m changing this based on its state, but the agent still walks right up to the target instead of firing from afar. Any help for this noob? Thx in advance.
Michael
code:
if (state == st.Follow){
endReachedDistance = 0.2f;
target = followPoint;
//Calculate desired velocity
}//follow AI
if (state == st.Attack){
target = attackTarget;
endReachedDistance = range;
if (target == null){
state = st.Follow;
target = followPoint;
}
}//Attack AI