1 #include "hx3d/physics/2d/attractor.hpp" 14 collider->currentAttractor = attractor;
15 attractor->computeForce(collider, dt);
19 if (attractor->overlaps(collider)) {
26 if (current == attractor) {
27 attractor->computeForce(collider, dt);
31 unsigned int currentType =
static_cast<unsigned int>(current->type);
32 unsigned int attractorType =
static_cast<unsigned int>(attractor->type);
34 if (attractorType > currentType) {
38 else if (attractorType == currentType) {
39 if (attractor->priority > current->priority) {
45 if (!current->overlaps(collider)) {
Attractor(Type type)
Create an attractor.
static void applyForce(const Ptr< Collider > &collider, const Ptr< Attractor > &attractor, const float dt)
Apply an attractor force on a collider.
static void setCurrentAttractor(const Ptr< Collider > &collider, const Ptr< Attractor > &attractor, const float dt)
Defines the current attractor on a collider.
std::shared_ptr< T > Ptr
Quick-typing shared ptr.