![]() |
Jopnal Engine
alpha 0.4
Simple Component Based 2D/3D Game Engine
|
#include <Collider2D.hpp>
Public Member Functions | |
| bool | checkOverlap (const Collider2D &other) const |
| Check if this collider overlaps with another. More... | |
| bool | checkContact (const Collider2D &other) const |
| Check if this collider is in contact with another. More... | |
| bool | checkRay (const glm::vec2 &start, const glm::vec2 &ray) const |
| Check if a ray pierces this collider. More... | |
| void | registerListener (ContactListener2D &listener) |
| Register a listener for this collider. More... | |
| World2D & | getWorld () |
| Get the world this collider belongs to. More... | |
| const World2D & | getWorld () const |
| Get the world this collider belongs to. More... | |
Public Member Functions inherited from jop::Component | |
| virtual | ~Component ()=0 |
| Virtual destructor. More... | |
| Message::Result | sendMessage (const Message &message) |
| Send a message to this component. More... | |
| uint32 | getID () const |
| Get the identifier. More... | |
| void | setID (const uint32 ID) |
| Set the identifier. More... | |
| WeakReference< Object > | getObject () |
| Get the object this component is bound to. More... | |
| WeakReference< const Object > | getObject () const |
| Get the object this component is bound to. More... | |
| bool | isActive () const |
| Check if this component is active. More... | |
| void | removeSelf () |
| Remove this component from its object. More... | |
Protected Member Functions | |
| Collider2D (Object &object, World2D &world, const uint32 ID) | |
| Constructor. More... | |
| Collider2D (const Collider2D &other, Object &newObj) | |
| Copy constructor. More... | |
| virtual | ~Collider2D () override=0 |
| Virtual destructor. More... | |
| void | update (const float deltaTime) override |
| Update. More... | |
| void | setAllowSleep (const bool allow) |
| Set whether the collider is allowed to sleep. More... | |
| bool | isSleepAllowed () const |
| Check if sleep is allowed. More... | |
Protected Member Functions inherited from jop::Component | |
| Component (Object &object, const uint32 ID) | |
| Constructor. More... | |
| Component (const Component &other, Object &newObj) | |
| Copy constructor. More... | |
| virtual Message::Result | receiveMessage (const Message &message) |
| Receive a message. More... | |
Protected Attributes | |
| b2Body * | m_body |
| A RigidBody2D. More... | |
| World2D & | m_worldRef2D |
| Reference to the world. More... | |
| std::set< ContactListener2D * > | m_listeners |
| Bound contact listeners. More... | |
Friends | |
| class | ContactListener2D |
| class | Joint2D |
Definition at line 46 of file Collider2D.hpp.
Constructor.
| object | Reference to the object |
| world | Reference to the physics world |
| ID | Id of this component |
|
protected |
Copy constructor.
| other | The other collider to copy |
| newObj | The new object |
|
overrideprotectedpure virtual |
Virtual destructor.
| bool jop::Collider2D::checkContact | ( | const Collider2D & | other | ) | const |
Check if this collider is in contact with another.
| other | The other collider to check against |
| bool jop::Collider2D::checkOverlap | ( | const Collider2D & | other | ) | const |
Check if this collider overlaps with another.
This will compare the axis-aligned bounding boxes. To check if two colliders are actually touching, use checkContact().
| other | The other collider to check against |
| bool jop::Collider2D::checkRay | ( | const glm::vec2 & | start, |
| const glm::vec2 & | ray | ||
| ) | const |
Check if a ray pierces this collider.
| start | The start position of the ray |
| ray | Ray to be shot from start |
| World2D& jop::Collider2D::getWorld | ( | ) |
Get the world this collider belongs to.
| const World2D& jop::Collider2D::getWorld | ( | ) | const |
Get the world this collider belongs to.
|
protected |
Check if sleep is allowed.
| void jop::Collider2D::registerListener | ( | ContactListener2D & | listener | ) |
Register a listener for this collider.
Single collider can have multiple listeners
| listener | Reference to the listener which is to be registered for this collider |
|
protected |
Set whether the collider is allowed to sleep.
| allow | True to allow sleep. True by default |
|
overrideprotectedvirtual |
|
friend |
Definition at line 50 of file Collider2D.hpp.
|
friend |
Definition at line 55 of file Collider2D.hpp.
|
protected |
A RigidBody2D.
Definition at line 141 of file Collider2D.hpp.
|
protected |
Bound contact listeners.
Definition at line 143 of file Collider2D.hpp.
|
protected |
Reference to the world.
Definition at line 142 of file Collider2D.hpp.
1.8.11