hx3d
1
2D/3D Simple Game Framework
|
Physical gravity attractor. More...
#include <attractor.hpp>
Public Types |
Public Member Functions | |
Attractor (Type type) | |
Create an attractor. More... | |
virtual bool | overlaps (const Ptr< Collider > &collider)=0 |
Check if a collider overlaps the attractor. More... | |
virtual void | computeForce (const Ptr< Collider > &collider, const float dt)=0 |
Compute the gravity force on a collider. More... | |
Static Public Member Functions | |
static void | setCurrentAttractor (const Ptr< Collider > &collider, const Ptr< Attractor > &attractor, const float dt) |
Defines the current attractor on a collider. More... | |
static void | applyForce (const Ptr< Collider > &collider, const Ptr< Attractor > &attractor, const float dt) |
Apply an attractor force on a collider. More... | |
Public Attributes | |
Type | type |
Attractor type. | |
unsigned int | priority |
Attractor priority. | |
Physical gravity attractor.
Definition at line 34 of file attractor.hpp.
|
strong |
Attractor type.
Enumerator | |
---|---|
Global |
Global attractor. |
Zone |
Zone attractor. |
Point |
Point attractor. |
Definition at line 39 of file attractor.hpp.
hx3d::physics2d::Attractor::Attractor | ( | Type | type | ) |
|
static |
Apply an attractor force on a collider.
Definition at line 18 of file attractor.cpp.
|
pure virtual |
Compute the gravity force on a collider.
collider | Collider (Ptr) |
dt | Delta time |
Implemented in hx3d::physics2d::ZoneAttractor, hx3d::physics2d::GlobalAttractor, and hx3d::physics2d::PointAttractor.
Check if a collider overlaps the attractor.
collider | Collider (Ptr) |
Implemented in hx3d::physics2d::ZoneAttractor, hx3d::physics2d::GlobalAttractor, and hx3d::physics2d::PointAttractor.
|
static |
Defines the current attractor on a collider.
Definition at line 13 of file attractor.cpp.