|
hx3d
1
2D/3D Simple Game Framework
|
Physical collider. More...
#include <collider.hpp>
Classes | |
| struct | Definition |
| Collider definition. More... | |
Public Types |
Public Member Functions | |
| 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... | |
| virtual void | computeMass (float density)=0 |
| Compute the collider mass. More... | |
| virtual void | setOrientation (float angle)=0 |
| Set the collider orientation. 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 | |
| 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. | |
Physical collider.
Definition at line 40 of file collider.hpp.
|
strong |
Collider shape.
| Enumerator | |
|---|---|
| Circle |
Circle shape. |
| Polygon |
Polygon shape. |
Definition at line 58 of file collider.hpp.
|
strong |
Collider type.
| Enumerator | |
|---|---|
| Static |
Static: no forces or velocity. |
| Dynamic |
Dynamic: forces and velocity. |
| Kinematic |
Kinematic: no forces but velocity. |
Definition at line 46 of file collider.hpp.
| hx3d::physics2d::Collider::Collider | ( | const Shape | shapeType, |
| const Type | colliderType = Type::Dynamic |
||
| ) |
Create a collider.
Definition at line 34 of file collider.cpp.
| void hx3d::physics2d::Collider::applyForce | ( | const glm::vec2 & | amount | ) |
| void hx3d::physics2d::Collider::applyImpulse | ( | const glm::vec2 & | amount, |
| const glm::vec2 & | contact | ||
| ) |
Apply an impulse.
| amount | Amount |
| contact | Contact point |
Definition at line 61 of file collider.cpp.
|
pure virtual |
Compute the collider mass.
| density | Density |
Implemented in hx3d::physics2d::colliders::Polygon, and hx3d::physics2d::colliders::Circle.
| void hx3d::physics2d::Collider::setDensity | ( | float | density | ) |
|
pure virtual |
Set the collider orientation.
| angle | Angle in radians |
Implemented in hx3d::physics2d::colliders::Polygon, and hx3d::physics2d::colliders::Circle.
| void hx3d::physics2d::Collider::useDefinition | ( | const Definition & | def | ) |
Apply a definition on the collider.
| def | Collider definition |
Definition at line 50 of file collider.cpp.
1.8.11