small refactoring

master
Vectozavr 2022-03-04 01:54:01 +07:00
parent 874df60941
commit 2b39c00b6c
3 changed files with 3 additions and 3 deletions

View File

@ -57,7 +57,7 @@ Vec4D Vec4D::operator/(double number) const {
// Other useful methods // Other useful methods
double Vec4D::sqrAbs() const { double Vec4D::sqrAbs() const {
return x() * x() + y() * y() + z() * z(); return x() * x() + y() * y() + z() * z() + w() * w();
} }
double Vec4D::abs() const { double Vec4D::abs() const {

View File

@ -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) { 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); _hitBox = HitBox(*this, useSimpleBox);
} }

View File

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