This commit is contained in:
aozhiwei 2022-11-30 12:07:01 +08:00
parent a4b3011448
commit a2d1f9d4a3

View File

@ -17,6 +17,8 @@ bool MoveHelper::GetMovePosition(glm::vec3& out_pos)
void MoveHelper::CalcTargetPos(float distance) void MoveHelper::CalcTargetPos(float distance)
{ {
paths_.clear();
glm::vec3 start; glm::vec3 start;
glm::vec3 end; glm::vec3 end;
glm::vec3 hit_point; glm::vec3 hit_point;
@ -28,13 +30,12 @@ void MoveHelper::CalcTargetPos(float distance)
end.x = target_pos2d.x / 10.0f; end.x = target_pos2d.x / 10.0f;
end.z = target_pos2d.y / 10.0f; end.z = target_pos2d.y / 10.0f;
//last_pos_.x = GetPos().x; MovePathPoint point;
//last_pos_.z = GetPos().y;
int ret = owner_->room->map_instance->Raycast(0, start, end, hit_point); int ret = owner_->room->map_instance->Raycast(0, start, end, hit_point);
if (ret > 1) { if (ret > 1) {
//SetTargetPos(hit_point * 10.0f); point.pos = hit_point * 10.f;
} else { } else {
//SetTargetPos(end * 10.0f); point.pos = end * 10.f;
} }
paths_.push_back(point);
} }