small refactoring
parent
0929f9c3a8
commit
b6f6c94133
|
@ -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)
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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; }
|
||||
|
|
Loading…
Reference in New Issue