This commit is contained in:
aozhiwei 2022-12-19 14:58:47 +08:00
parent b224941ddd
commit 79bdb05b9e

View File

@ -26,6 +26,7 @@ bool MoveHelper::UpdatePosition()
a8::Vec2 dir = a8::Vec2(curr_point.dir.x, curr_point.dir.z);
float h = 0.0f;
if (owner_->room->map_instance->GetPosHeight(curr_point.curr_pos, h)) {
#ifdef DEBUG1
a8::XPrintf("pos:%f,%f,%f h1:%f\n",
{
owner_->GetPos().x,
@ -33,6 +34,7 @@ bool MoveHelper::UpdatePosition()
owner_->GetPos().z,
h
});
#endif
curr_point.curr_pos.y = h;
} else {
//abort();
@ -40,6 +42,7 @@ bool MoveHelper::UpdatePosition()
curr_point.curr_pos.AddVec2(dir * owner_->GetSpeed());
owner_->SetPos(curr_point.curr_pos);
if (owner_->room->map_instance->GetPosHeight(owner_->GetPos(), h)) {
#ifdef DEBUG1
a8::XPrintf("pos:%f,%f,%f h2:%f\n",
{
owner_->GetPos().x,
@ -47,6 +50,7 @@ bool MoveHelper::UpdatePosition()
owner_->GetPos().z,
h
});
#endif
auto new_pos = owner_->GetPos();
new_pos.y = h;
owner_->SetPos(new_pos);