Physics3D/Collider3D: Use btEmptyShape for NullCollider3D
Having no collider seems to break physics
This commit is contained in:
parent
5126b5f8a2
commit
1f68cfa6c2
|
|
@ -25,6 +25,7 @@ class btCollisionShape;
|
|||
class btConeShape;
|
||||
class btConvexHullShape;
|
||||
class btCylinderShape;
|
||||
class btEmptyShape;
|
||||
class btSphereShape;
|
||||
|
||||
namespace Nz
|
||||
|
|
@ -179,8 +180,8 @@ namespace Nz
|
|||
class NAZARA_PHYSICS3D_API NullCollider3D final : public Collider3D
|
||||
{
|
||||
public:
|
||||
NullCollider3D() = default;
|
||||
~NullCollider3D() = default;
|
||||
NullCollider3D();
|
||||
~NullCollider3D();
|
||||
|
||||
void BuildDebugMesh(std::vector<Vector3f>& vertices, std::vector<UInt16>& indices, const Matrix4f& offsetMatrix) const override;
|
||||
|
||||
|
|
@ -188,6 +189,9 @@ namespace Nz
|
|||
|
||||
btCollisionShape* GetShape() const override;
|
||||
ColliderType3D GetType() const override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<btEmptyShape> m_shape;
|
||||
};
|
||||
|
||||
class NAZARA_PHYSICS3D_API SphereCollider3D final : public Collider3D
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include <BulletCollision/CollisionShapes/btConeShape.h>
|
||||
#include <BulletCollision/CollisionShapes/btConvexHullShape.h>
|
||||
#include <BulletCollision/CollisionShapes/btCylinderShape.h>
|
||||
#include <BulletCollision/CollisionShapes/btEmptyShape.h>
|
||||
#include <BulletCollision/CollisionShapes/btSphereShape.h>
|
||||
#include <Nazara/Physics3D/Debug.hpp>
|
||||
|
||||
|
|
@ -371,6 +372,13 @@ namespace Nz
|
|||
|
||||
/********************************* NullCollider3D **********************************/
|
||||
|
||||
NullCollider3D::NullCollider3D()
|
||||
{
|
||||
m_shape = std::make_unique<btEmptyShape>();
|
||||
}
|
||||
|
||||
NullCollider3D::~NullCollider3D() = default;
|
||||
|
||||
void NullCollider3D::BuildDebugMesh(std::vector<Vector3f>& /*vertices*/, std::vector<UInt16>& /*indices*/, const Matrix4f& /*offsetMatrix*/) const
|
||||
{
|
||||
}
|
||||
|
|
@ -382,7 +390,7 @@ namespace Nz
|
|||
|
||||
btCollisionShape* NullCollider3D::GetShape() const
|
||||
{
|
||||
return nullptr;
|
||||
return m_shape.get();
|
||||
}
|
||||
|
||||
ColliderType3D NullCollider3D::GetType() const
|
||||
|
|
|
|||
Loading…
Reference in New Issue