small refactoring

master
Vectozavr 2022-03-05 17:40:25 +07:00
parent 0929f9c3a8
commit b6f6c94133
3 changed files with 2 additions and 8 deletions

View File

@ -38,7 +38,7 @@ void HitBox::generateSimple(const Mesh &mesh) {
for(const auto& t : mesh.triangles()) {
for(int i = 0; i < 3; i++) {
auto point = mesh.model()*Vec3D(t[i]);
auto point = Vec3D(t[i]);
if(point.x() > maxX) {
maxX = point.x();
}
@ -78,7 +78,7 @@ void HitBox::generateDetailed(const Mesh &mesh) {
for (const auto& t : mesh.triangles())
for (int i = 0; i < 3; i++)
points.insert(mesh.model()*Vec3D(t[i]));
points.insert(Vec3D(t[i]));
_hitBox.reserve(points.size());
for (const auto& it : points)

View File

@ -18,10 +18,6 @@ RigidBody::RigidBody(ObjectNameTag nameTag, const std::string &filename, const V
RigidBody::RigidBody(const Mesh &mesh, bool useSimpleBox) : Mesh(mesh), _hitBox(mesh, useSimpleBox) {
}
void RigidBody::recalculateHitBox(bool useSimpleBox) {
_hitBox = HitBox(*this, useSimpleBox);
}
Vec3D RigidBody::_findFurthestPoint(const Vec3D &direction) {
Vec3D maxPoint{0, 0, 0};

View File

@ -70,8 +70,6 @@ public:
[[nodiscard]] CollisionPoint EPA(const Simplex &simplex, std::shared_ptr<RigidBody> obj);
void solveCollision(const CollisionPoint &collision);
void recalculateHitBox(bool useSimpleBox = true);
[[nodiscard]] Vec3D collisionNormal() const { return _collisionNormal; }
[[nodiscard]] bool hasCollision() const { return _hasCollision; }
[[nodiscard]] bool inCollision() const { return _inCollision; }