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