This commit is contained in:
aozhiwei 2022-12-28 16:10:55 +08:00
parent 53a970b8bf
commit a96777029b

View File

@ -3089,15 +3089,11 @@ void Creature::FollowToTarget()
#else
if (GetPos().ManhattanDistance(follow_target.Get()->GetPos()) > 70) {
#endif
a8::Vec2 dir = a8::Vec2::UP;
dir.Rotate(a8::RandAngle());
dir.Normalize();
// 999
#if 1
Position target_pos = follow_target.Get()->GetPos();
#else
a8::Vec2 target_pos = follow_target.Get()->GetPos() + dir * (30 + (rand() % 10));
#endif
glm::vec3 dir = GlmHelper::UP;
GlmHelper::RotateY(dir, a8::RandAngle());
GlmHelper::Normalize(dir);
Position target_pos;
target_pos.FromGlmVec3(follow_target.Get()->GetPos().ToGlmVec3() + dir * (float)(30 + (rand() % 10)));
if (GetPos().ManhattanDistance2D(target_pos) > 5) {
glm::vec3 move_dir = GetPos().CalcDir(target_pos);
GlmHelper::Normalize(move_dir);