A body that can receive collisions.
More...
#include <CollisionBody.hpp>
|
| CollisionBody () |
|
Transform * | Trans () |
| Gets the transform of the body.
|
|
void | SetTransform (const Transform &transform) |
| Sets the transform of the body.
|
|
Collider * | Col () const |
| Gets the collider of the body.
|
|
void | SetCollider (Collider *collider) |
| Sets the collider of the body.
|
|
bool | IsTrigger () const |
| A boolean saying if the collider is a trigger collider. This means that it will not have a collision response and will only have a callback.
|
|
void | SetIsTrigger (bool isTrigger) |
| Sets is trigger on the body. True means that it will not have a collision response and will only have a callback.
|
|
void | SetCollisionCallback (const std::function< void(const Collision &, float)> &callback) |
| Sets the collision callback function.
|
|
void | OnCollision (const Collision &collision, float deltaTime) const |
| Triggers the collision callback function.
|
|
const Vector2 & | Position () const |
| Gets the position of the body in the world.
|
|
void | SetPosition (const Vector2 &position) |
| Sets the position of the body in the world.
|
|
bool | IsKinematic () const |
| Gets a boolean that indicates if this body will receive a collision response.
|
|
void | SetIsKinematic (bool isKinematic) |
| Sets a boolean that indicates if this body will receive a collision response.
|
|
bool | IsDynamic () const |
| Gets a boolean indicating if this body is dynamic. This means that this is a Rigidbody.
|
|
A body that can receive collisions.
◆ CollisionBody()
stw::CollisionBody::CollisionBody |
( |
| ) |
|
◆ Col()
Collider * stw::CollisionBody::Col |
( |
| ) |
const |
Gets the collider of the body.
- Returns
- The collider of the body.
◆ IsDynamic()
bool stw::CollisionBody::IsDynamic |
( |
| ) |
const |
Gets a boolean indicating if this body is dynamic. This means that this is a Rigidbody.
- See also
- Rigidbody
- Returns
- A boolean indicating if this body is dynamic.
◆ IsKinematic()
bool stw::CollisionBody::IsKinematic |
( |
| ) |
const |
Gets a boolean that indicates if this body will receive a collision response.
- Returns
- A boolean that indicates if this body is kinematic.
◆ IsTrigger()
bool stw::CollisionBody::IsTrigger |
( |
| ) |
const |
A boolean saying if the collider is a trigger collider. This means that it will not have a collision response and will only have a callback.
- Returns
- If the collider is a trigger collider.
◆ OnCollision()
void stw::CollisionBody::OnCollision |
( |
const Collision & | collision, |
|
|
float | deltaTime ) const |
Triggers the collision callback function.
- Parameters
-
collision | Object representing the collision. |
deltaTime | The time elapsed since the last frame. |
◆ Position()
const Vector2 & stw::CollisionBody::Position |
( |
| ) |
const |
Gets the position of the body in the world.
- Returns
- The position of the body in the world.
◆ SetCollider()
void stw::CollisionBody::SetCollider |
( |
Collider * | collider | ) |
|
Sets the collider of the body.
- Parameters
-
collider | The collider to set on the body. |
◆ SetCollisionCallback()
void stw::CollisionBody::SetCollisionCallback |
( |
const std::function< void(const Collision &, float)> & | callback | ) |
|
Sets the collision callback function.
- Parameters
-
callback | The callback function. |
◆ SetIsKinematic()
void stw::CollisionBody::SetIsKinematic |
( |
bool | isKinematic | ) |
|
Sets a boolean that indicates if this body will receive a collision response.
- Parameters
-
isKinematic | The new isKinematic status. |
◆ SetIsTrigger()
void stw::CollisionBody::SetIsTrigger |
( |
bool | isTrigger | ) |
|
Sets is trigger on the body. True means that it will not have a collision response and will only have a callback.
- Parameters
-
isTrigger | The boolean saying if the collider is trigger. |
◆ SetPosition()
void stw::CollisionBody::SetPosition |
( |
const Vector2 & | position | ) |
|
Sets the position of the body in the world.
- Parameters
-
position | The new position of the body. |
◆ SetTransform()
void stw::CollisionBody::SetTransform |
( |
const Transform & | transform | ) |
|
Sets the transform of the body.
- Parameters
-
◆ Trans()
Gets the transform of the body.
- Returns
- The transform of the body.
◆ _collider
Collider* stw::CollisionBody::_collider {} |
|
protected |
◆ _isDynamic
bool stw::CollisionBody::_isDynamic = false |
|
protected |
◆ _isKinematic
bool stw::CollisionBody::_isKinematic = false |
|
protected |
◆ _isTrigger
bool stw::CollisionBody::_isTrigger = false |
|
protected |
◆ _lastTransform
Transform stw::CollisionBody::_lastTransform {} |
|
protected |
◆ _onCollisions
std::function<void(const Collision&, float) stw::CollisionBody::_onCollisions) |
|
protected |
◆ _transform
◆ id
std::uint64_t stw::CollisionBody::id |
The documentation for this class was generated from the following files: