This commit is contained in:
aozhiwei 2022-12-14 13:49:37 +08:00
parent 604d8d5bb1
commit 0a22db99d6
4 changed files with 30 additions and 7 deletions

View File

@ -73,11 +73,7 @@ bool MoveHelper::GetMovePosition(glm::vec3& out_pos)
void MoveHelper::CalcTargetPos(float distance)
{
// 999
#if 1
#else
ClearPath();
Creature* c = (Creature*)owner_;
#ifdef DEBUG1
if (!c->IsPlayer()) {
a8::XPrintf("CalcTaretPos old_size:%d\n", {paths_.size()});
@ -166,7 +162,6 @@ void MoveHelper::CalcTargetPos(float distance)
point.dir.z = dir.y;
paths_.push_back(point);
#endif
}
void MoveHelper::ClearPath()

View File

@ -25,7 +25,6 @@ a8::Vec2 Position::CalcDir2D(const Position& target_pos)
return target_pos.ToVec2() - ToVec2();
}
a8::Vec2 Position::ToVec2() const
{
a8::Vec2 v2;
@ -33,3 +32,29 @@ a8::Vec2 Position::ToVec2() const
v2.y = y;
return v2;
}
a8::Vec3 Position::ToVec3() const
{
a8::Vec3 v;
v.x = x;
v.y = y;
v.z = z;
return v;
}
glm::vec2 Position::ToGlmVec2() const
{
glm::vec2 v;
v.x = x;
v.y = y;
return v;
}
glm::vec3 Position::ToGlmVec3() const
{
glm::vec3 v;
v.x = x;
v.y = y;
v.z = z;
return v;
}

View File

@ -77,4 +77,7 @@ struct Position
float ManhattanDistance2D(const Position& target_pos);
a8::Vec2 CalcDir2D(const Position& target_pos);
a8::Vec2 ToVec2() const;
a8::Vec3 ToVec3() const;
glm::vec2 ToGlmVec2() const;
glm::vec3 ToGlmVec3() const;
};

2
third_party/a8 vendored

@ -1 +1 @@
Subproject commit a2c41b1b7edff7e31c8d5f33eb9572a423d3c3bb
Subproject commit a71317e2a091eb560ead8dc45d61a02d7266db91