47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <XCEngine/Components/Component.h>
|
|
#include <XCEngine/Core/Math/Vector3.h>
|
|
#include <cstdint>
|
|
|
|
namespace XCEngine {
|
|
namespace Components {
|
|
|
|
enum class ColliderAxis : uint8_t {
|
|
X = 0,
|
|
Y = 1,
|
|
Z = 2
|
|
};
|
|
|
|
class ColliderComponent : public Component {
|
|
public:
|
|
bool IsTrigger() const { return m_isTrigger; }
|
|
void SetTrigger(bool value) { m_isTrigger = value; }
|
|
|
|
const Math::Vector3& GetCenter() const { return m_center; }
|
|
void SetCenter(const Math::Vector3& value);
|
|
|
|
float GetStaticFriction() const { return m_staticFriction; }
|
|
void SetStaticFriction(float value);
|
|
|
|
float GetDynamicFriction() const { return m_dynamicFriction; }
|
|
void SetDynamicFriction(float value);
|
|
|
|
float GetRestitution() const { return m_restitution; }
|
|
void SetRestitution(float value);
|
|
|
|
protected:
|
|
void SerializeBase(std::ostream& os) const;
|
|
bool DeserializeBaseField(const std::string& key, const std::string& value);
|
|
|
|
private:
|
|
bool m_isTrigger = false;
|
|
Math::Vector3 m_center = Math::Vector3::Zero();
|
|
float m_staticFriction = 0.6f;
|
|
float m_dynamicFriction = 0.6f;
|
|
float m_restitution = 0.0f;
|
|
};
|
|
|
|
} // namespace Components
|
|
} // namespace XCEngine
|