From 2b39c00b6caedff2cb0f92c18c3f6c74e8232b12 Mon Sep 17 00:00:00 2001 From: Vectozavr <60608292+vectozavr@users.noreply.github.com> Date: Fri, 4 Mar 2022 01:54:01 +0700 Subject: [PATCH] small refactoring --- engine/Vec4D.cpp | 2 +- engine/physics/RigidBody.cpp | 2 +- engine/physics/RigidBody.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engine/Vec4D.cpp b/engine/Vec4D.cpp index b11321a..7d80487 100644 --- a/engine/Vec4D.cpp +++ b/engine/Vec4D.cpp @@ -57,7 +57,7 @@ Vec4D Vec4D::operator/(double number) const { // Other useful methods double Vec4D::sqrAbs() const { - return x() * x() + y() * y() + z() * z(); + return x() * x() + y() * y() + z() * z() + w() * w(); } double Vec4D::abs() const { diff --git a/engine/physics/RigidBody.cpp b/engine/physics/RigidBody.cpp index 0d1db28..01b12f1 100644 --- a/engine/physics/RigidBody.cpp +++ b/engine/physics/RigidBody.cpp @@ -18,7 +18,7 @@ RigidBody::RigidBody(ObjectNameTag nameTag, const std::string &filename, const V RigidBody::RigidBody(const Mesh &mesh, bool useSimpleBox) : Mesh(mesh), _hitBox(mesh, useSimpleBox) { } -void RigidBody::regenerateHitBox(bool useSimpleBox) { +void RigidBody::recalculateHitBox(bool useSimpleBox) { _hitBox = HitBox(*this, useSimpleBox); } diff --git a/engine/physics/RigidBody.h b/engine/physics/RigidBody.h index 98d02a3..e1e8919 100644 --- a/engine/physics/RigidBody.h +++ b/engine/physics/RigidBody.h @@ -70,7 +70,7 @@ public: [[nodiscard]] CollisionPoint EPA(const Simplex &simplex, std::shared_ptr obj); void solveCollision(const CollisionPoint &collision); - void regenerateHitBox(bool useSimpleBox = true); + void recalculateHitBox(bool useSimpleBox = true); [[nodiscard]] Vec3D collisionNormal() const { return _collisionNormal; } [[nodiscard]] bool hasCollision() const { return _hasCollision; }