Physics2D: Add support for SegmentCollider2D

This commit is contained in:
Lynix
2016-11-18 18:00:48 +01:00
parent 950068a60d
commit ac2193e0c2
3 changed files with 79 additions and 1 deletions

View File

@@ -49,6 +49,36 @@ namespace Nz
return object.release();
}
SegmentCollider2D::SegmentCollider2D(const Vector2f& first, const Vector2f& second, float thickness) :
m_first(first),
m_second(second),
m_thickness(thickness)
{
}
inline const Vector2f& SegmentCollider2D::GetFirstPoint() const
{
return m_first;
}
inline float SegmentCollider2D::GetLength() const
{
return m_first.Distance(m_second);
}
inline const Vector2f& SegmentCollider2D::GetSecondPoint() const
{
return m_second;
}
template<typename... Args>
SegmentCollider2DRef SegmentCollider2D::New(Args&&... args)
{
std::unique_ptr<SegmentCollider2D> object(new SegmentCollider2D(std::forward<Args>(args)...));
object->SetPersistent(false);
return object.release();
}
}
#include <Nazara/Physics2D/DebugOff.hpp>