21 #ifndef HX3D_PHYSICS_2D_COLLIDERS_POLYGON 22 #define HX3D_PHYSICS_2D_COLLIDERS_POLYGON 24 #include "hx3d/physics/2d/collider.hpp" 49 void setPoints(
const std::vector<glm::vec2>& points);
57 void setAsBox(
const float width,
const float height);
void setAsBox(const float width, const float height)
Set the polygon points as a box.
std::vector< glm::vec2 > normals
Normals.
glm::vec2 getSupport(glm::vec2 dir)
Get the support vector following a direction.
void setPoints(const std::vector< glm::vec2 > &points)
Set the polygon points.
virtual void computeMass(float density) override
Compute the collider mass.
Polygon(const Type colliderType=Type::Dynamic)
Create a polygon.
std::vector< glm::vec2 > vertices
Vertices.
Dynamic: forces and velocity.
bool box
Is the polygon a box ?
unsigned int vertexCount
Vertex count.
virtual void setOrientation(float angle) override
Set the collider orientation.
glm::mat2 u
Rotation matrix.
Polygon or box shaped collider.