NWengine 0.9
|
The Collider class represents a base collider component. More...
#include <Collider.h>
Public Member Functions | |
fVec2 | GetPosition () |
Get the position of the collider. | |
fVec2 | GetEdgePosition (int index) |
Get the position of a specific edge of the collider. | |
Collider (GameObject *go) | |
bool | Sat (Collider *other, fVec2 *depthBuffer=nullptr) |
Check if this collider is colliding with another collider using the Separating Axis Theorem (SAT). | |
bool | isColliding (Collider *other, fVec2 *depthBuffer=nullptr) |
Check if this collider is colliding with another collider. | |
void | Start () override |
Start the game component. | |
int | Serialize (std::fstream *data, int offset) override |
Serialize the object and write it to the file. | |
int | Deserialize (std::fstream *data, int offset) override |
Deserialize the object from the file. | |
Public Member Functions inherited from GameComponent | |
virtual void | Update () |
Update the game component. | |
virtual void | SetGameObject (void *go) |
Set the GameObject associated with the game component. | |
virtual void * | GetGameObject () |
Get the GameObject associated with the game component. | |
virtual | ~GameComponent () |
Destructor for the game component. | |
Public Member Functions inherited from Serialized | |
Serialized () | |
Default constructor for Serialized class. | |
Static Public Member Functions | |
static std::string | GetType () |
Get the type of the collider. | |
Static Public Member Functions inherited from GameComponent | |
static std::string | GetType () |
Get the type of the game component. | |
Public Attributes | |
GameObject * | attachedObj |
fVec2 | offset = fVec2(0.0f, 0.0f) |
std::vector< fVec2 > | edges = { fVec2(100,100), fVec2(-100,100), fVec2(-100,-100), fVec2(100,-100) } |
The Collider class represents a base collider component.
Represents a collider component that can be attached to a game object.
Deserialize the object from the file.
data | The file stream to read the serialized data from. |
offset | The offset in the file to start reading the serialized data. |
Reimplemented from Serialized.
Get the position of a specific edge of the collider.
index | The index of the edge. |
fVec2 Collider::GetPosition | ( | ) |
Get the position of the collider.
|
inlinestatic |
Get the type of the collider.
Check if this collider is colliding with another collider.
other | The other collider to check against. |
depthBuffer | A pointer to a vector to store the collision depth. |
Check if this collider is colliding with another collider using the Separating Axis Theorem (SAT).
other | The other collider to check against. |
depthBuffer | A pointer to a vector to store the collision depth. |
Serialize the object and write it to the file.
data | The file stream to write the serialized data to. |
offset | The offset in the file to start writing the serialized data. |
Reimplemented from Serialized.
|
overridevirtual |
Start the game component.
Reimplemented from GameComponent.