This commit is contained in:
aozhiwei 2023-11-21 11:12:07 +08:00
parent 97e48f3410
commit a4f68c9147
2 changed files with 11 additions and 7 deletions

View File

@ -22,7 +22,8 @@ class Collision
--dw dh
--dro
*/
static bool Check2dRotationRectangle(float rx, float ry, float r, float dx, float dy, float dw, float dh, float dro);
static bool Check2dRotationRectangle(float rx, float ry, float r,
float dx, float dy, float dw, float dh, float dro);
static bool InSquare(const glm::vec3& center, const glm::vec3& pos, float side_len);

View File

@ -901,24 +901,27 @@ void RoomObstacle::RemoveSameSkillObstacle()
void RoomObstacle::ActiveFlameSurface()
{
ForceGridList();
glm::vec3 dir = GlmHelper::UP;
GlmHelper::RotateY(dir, rotate_);
glm::vec3 adjusted_pos = GetPos().ToGlmVec3() + dir * (meta->height() / 2.0f);
auto cb =
[this] ()
[this, adjusted_pos] ()
{
std::set<Human*> human_list;
room->grid_service->TraverseAllLayerHumanList
(room->GetRoomIdx(),
*grid_list_,
[this, &human_list] (Human* hum, bool& stop)
[this, &human_list, &adjusted_pos] (Human* hum, bool& stop)
{
if (Collision::Check2dRotationRectangle
(
hum->GetPos().GetX(),
hum->GetPos().GetZ(),
hum->GetHitRadius(),
0,
0,
0,
0,
adjusted_pos.x,
adjusted_pos.z,
meta->width() / 2.0f,
meta->height() / 2.0f,
GetRotate() * 180.f
)) {
}