BulletPhysics3D: Add StaticPlaneCollider3D

This commit is contained in:
SirLynix
2023-03-23 13:10:00 +01:00
committed by Jérôme Leclercq
parent 021801f02e
commit 3efd422e86
3 changed files with 65 additions and 2 deletions

View File

@@ -13,6 +13,7 @@
#include <Nazara/Core/ObjectLibrary.hpp>
#include <Nazara/Math/Box.hpp>
#include <Nazara/Math/Quaternion.hpp>
#include <Nazara/Math/Plane.hpp>
#include <Nazara/Math/Vector3.hpp>
#include <NazaraUtils/Signal.hpp>
#include <NazaraUtils/SparsePtr.hpp>
@@ -27,6 +28,7 @@ class btConvexHullShape;
class btCylinderShape;
class btEmptyShape;
class btSphereShape;
class btStaticPlaneShape;
namespace Nz
{
@@ -211,6 +213,26 @@ namespace Nz
Vector3f m_position;
float m_radius;
};
class NAZARA_BULLETPHYSICS3D_API BulletStaticPlaneCollider3D final : public BulletCollider3D
{
public:
BulletStaticPlaneCollider3D(const Planef& plane);
BulletStaticPlaneCollider3D(const Vector3f& normal, float distance);
~BulletStaticPlaneCollider3D();
void BuildDebugMesh(std::vector<Vector3f>& vertices, std::vector<UInt16>& indices, const Matrix4f& offsetMatrix) const override;
float GetDistance() const;
const Vector3f& GetNormal() const;
btCollisionShape* GetShape() const override;
ColliderType3D GetType() const override;
private:
std::unique_ptr<btStaticPlaneShape> m_shape;
Vector3f m_normal;
float m_distance;
};
}
#include <Nazara/BulletPhysics3D/BulletCollider3D.inl>

View File

@@ -21,9 +21,9 @@ namespace Nz
Null,
Scene,
Sphere,
Tree,
StaticPlane,
Max = Tree
Max = StaticPlane
};
}