Made the hurt hazard work better.
This commit is contained in:
@ -85,15 +85,13 @@ bool_t Dawn::boxIsBoxColliding(
|
||||
glm::vec2 posB, glm::vec2 minB, glm::vec2 maxB
|
||||
) {
|
||||
// Check for no overlap in X axis
|
||||
if (posA.x + maxA.x < posB.x + minB.x || posA.x + minA.x > posB.x + maxB.x) {
|
||||
if (posA.x + maxA.x < posB.x + minB.x || posB.x + maxB.x < posA.x + minA.x) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check for no overlap in Y axis
|
||||
if (posA.y + maxA.y < posB.y + minB.y || posA.y + minA.y > posB.y + maxB.y) {
|
||||
if (posA.y + maxA.y < posB.y + minB.y || posB.y + maxB.y < posA.y + minA.y) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// There is overlap in both X and Y axis, so the boxes are colliding
|
||||
return true;
|
||||
}
|
13
src/dawn/physics/2d/Physics2D.hpp
Normal file
13
src/dawn/physics/2d/Physics2D.hpp
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "dawnlibs.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
static inline glm::vec2 physics3Dto2D(glm::vec3 v) {
|
||||
return glm::vec2(v.x, v.z);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user