This commit is contained in:
aozhiwei 2024-09-10 10:50:01 +08:00
parent b4fd0bb29c
commit 03527680b0
2 changed files with 5 additions and 1 deletions

View File

@ -2701,8 +2701,8 @@ void Creature::UpdateMove()
} else {
if (IsPlayer() || HasBuffEffect(kBET_Sprint)) {
if (!GetMovement()->UpdatePosition()) {
GetMovement()->CalcTargetPos(mt::Param::s().move_step_len);
if (HasBuffEffect(kBET_Sprint)) {
GetMovement()->CalcTargetPos(mt::Param::s().move_step_len);
SprintBuff* buff = (SprintBuff*)GetBuffByEffectId(kBET_Sprint);
if (buff) {
buff->SprintEnd();

View File

@ -402,7 +402,11 @@ bool Movement::MoveToPos(const glm::vec3& target_pos)
}
#endif
if (GlmHelper::IsEqual2D(point.tar_pos.ToGlmVec3(), owner_->GetPos().ToGlmVec3())) {
return true;
}
glm::vec3 dir = point.tar_pos.ToGlmVec3() - owner_->GetPos().ToGlmVec3();
GlmHelper::Normalize(dir);
point.dir.x = dir.x;
point.dir.y = dir.y;