This commit is contained in:
aozhiwei 2023-10-14 14:05:01 +08:00
parent c2bd6e9c6f
commit eec40fd525
3 changed files with 7 additions and 2 deletions

View File

@ -90,3 +90,8 @@ bool GlmHelper::IsEqual3D(const glm::vec3& v1, const glm::vec3& v2)
std::abs(v1.y - v2.y) < 0.00001f &&
std::abs(v1.z - v2.z) < 0.00001f;
}
glm::vec3 GlmHelper::Vec2ToVec3(const glm::vec2& v2)
{
return glm::vec3(v2.x, 0.0f, v2.y);
}

View File

@ -20,5 +20,5 @@ class GlmHelper
static float CalcAngle(const glm::vec3& v1, const glm::vec3& v2);
static void FillVert(const glm::vec3& v, float* vert);
static glm::vec3 Vec2ToVec3(const glm::vec2& v2);
};

View File

@ -249,7 +249,7 @@ bool HeroAgent::HasBuffEffect(int effect_id)
bool HeroAgent::IsNearGas(float anti_range)
{
return Collision::InSquare
(owner_->GetPos().ToGlmVec3(),
(GlmHelper::Vec2ToVec3(owner_->room->GetGasData().pos_old),
owner_->GetPos().ToGlmVec3(),
anti_range);
}