hx3d  1
2D/3D Simple Game Framework
Public Member Functions | Public Attributes | List of all members
hx3d::physics2d::colliders::Polygon Struct Reference

Polygon or box shaped collider. More...

#include <polygon.hpp>

Public Member Functions

 Polygon (const Type colliderType=Type::Dynamic)
 Create a polygon. More...
 
void setPoints (const std::vector< glm::vec2 > &points)
 Set the polygon points. More...
 
void setAsBox (const float width, const float height)
 Set the polygon points as a box. More...
 
glm::vec2 getSupport (glm::vec2 dir)
 Get the support vector following a direction. More...
 
virtual void setOrientation (float angle) override
 Set the collider orientation. More...
 
virtual void computeMass (float density) override
 Compute the collider mass. More...
 
- Public Member Functions inherited from hx3d::physics2d::Collider
 Collider (const Shape shapeType, const Type colliderType=Type::Dynamic)
 Create a collider. More...
 
void useDefinition (const Definition &def)
 Apply a definition on the collider. More...
 
void applyForce (const glm::vec2 &amount)
 Apply a force. More...
 
void applyImpulse (const glm::vec2 &amount, const glm::vec2 &contact)
 Apply an impulse. More...
 
void setDensity (float density)
 Set collider density. More...
 

Public Attributes

unsigned int vertexCount
 Vertex count.
 
std::vector< glm::vec2 > vertices
 Vertices.
 
std::vector< glm::vec2 > normals
 Normals.
 
glm::mat2 u
 Rotation matrix.
 
bool box
 Is the polygon a box ?
 
- Public Attributes inherited from hx3d::physics2d::Collider
glm::vec2 position
 Position.
 
glm::vec2 velocity
 Velocity.
 
glm::vec2 force
 Force.
 
glm::vec2 gravityForce
 Gravity force.
 
glm::vec2 gravityScale
 Gravity scale.
 
float angularVelocity
 Angular velocity.
 
float torque
 Torque.
 
float orientation
 Orientation.
 
bool fixedRotation
 Fixed rotation ?
 
unsigned int mask
 Mask.
 
unsigned int category
 Category.
 
Type type
 Type.
 
Shape shape
 Shape.
 
Material material
 Material.
 
Mass massData
 Mass data.
 
Ptr< AttractorcurrentAttractor
 Current attractor.
 
ObjectMap userData
 User data.
 

Additional Inherited Members

- Public Types inherited from hx3d::physics2d::Collider

Detailed Description

Polygon or box shaped collider.

Definition at line 35 of file polygon.hpp.

Constructor & Destructor Documentation

hx3d::physics2d::colliders::Polygon::Polygon ( const Type  colliderType = Type::Dynamic)

Create a polygon.

Parameters
colliderTypeCollider type

Definition at line 9 of file polygon.cpp.

Member Function Documentation

void hx3d::physics2d::colliders::Polygon::computeMass ( float  density)
overridevirtual

Compute the collider mass.

Parameters
densityDensity

Implements hx3d::physics2d::Collider.

Definition at line 125 of file polygon.cpp.

glm::vec2 hx3d::physics2d::colliders::Polygon::getSupport ( glm::vec2  dir)

Get the support vector following a direction.

Parameters
dirDirection
Returns
Support vector

Definition at line 80 of file polygon.cpp.

void hx3d::physics2d::colliders::Polygon::setAsBox ( const float  width,
const float  height 
)

Set the polygon points as a box.

Parameters
widthBox width
heightBox height

Definition at line 97 of file polygon.cpp.

void hx3d::physics2d::colliders::Polygon::setOrientation ( float  angle)
overridevirtual

Set the collider orientation.

Parameters
angleAngle in radians

Implements hx3d::physics2d::Collider.

Definition at line 115 of file polygon.cpp.

void hx3d::physics2d::colliders::Polygon::setPoints ( const std::vector< glm::vec2 > &  points)

Set the polygon points.

Parameters
pointsPoints

Definition at line 14 of file polygon.cpp.


The documentation for this struct was generated from the following files: