hx3d
1
2D/3D Simple Game Framework
|
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... | |
![]() | |
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 ? | |
![]() | |
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< Attractor > | currentAttractor |
Current attractor. | |
ObjectMap | userData |
User data. | |
Additional Inherited Members | |
![]() |
Polygon or box shaped collider.
Definition at line 35 of file polygon.hpp.
hx3d::physics2d::colliders::Polygon::Polygon | ( | const Type | colliderType = Type::Dynamic | ) |
|
overridevirtual |
Compute the collider mass.
density | Density |
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.
dir | Direction |
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.
width | Box width |
height | Box height |
Definition at line 97 of file polygon.cpp.
|
overridevirtual |
Set the collider orientation.
angle | Angle 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 | ) |