|
|
| AABBCollider (std::shared_ptr< AABB > aabb, float stepHeight=0.0f) |
| |
|
void | setWorld (std::shared_ptr< World > world) |
| | Sets the world for this collider.
|
| |
|
void | setAABB (std::shared_ptr< AABB > aabb) |
| | Sets the AABB that will be checked for collisions against the world.
|
| |
| CollisionInfo | collide (glm::vec3 &moveStep, const glm::vec3 &position, float dt) |
| | Checks if the AABB collides with any blocks in the world.
|
| |
|
|
void | updateAABBCache (const glm::vec3 &velocity, const glm::vec3 &position) |
| |
|
SweptResult | swept (const glm::vec3 &velocity, const AABB &other) const |
| |
|
float | swept1D (int axis, float velocity, const AABB &other) |
| |
| float | tryStepUp (const glm::vec3 &horizontalMove, const SweptResult &bestRes) |
| | Attempts to step up when hitting a horizontal obstacle.
|
| |
|
|
std::shared_ptr< World > | m_world = nullptr |
| |
|
std::shared_ptr< AABB > | m_aabb |
| |
|
float | m_stepHeight |
| |
|
float | m_height |
| |
|
std::vector< AABB > | m_aabbCache |
| |
|
glm::ivec3 | m_lastPosition |
| |
|
glm::vec3 | m_cacheDirection |
| |
|
float | m_stepUpCooldown = 0.0f |
| |
|
| static constexpr glm::vec3 | s_checkBox {1.5f} |
| | The box around the AABB that will be generated, thus checked for collisions against the world.
|
| |
|
static constexpr float | s_epsGap = std::numeric_limits<float>::epsilon() * 64.0f |
| |
◆ collide()
| CollisionInfo AABBCollider::collide |
( |
glm::vec3 & |
moveStep, |
|
|
const glm::vec3 & |
position, |
|
|
float |
dt |
|
) |
| |
Checks if the AABB collides with any blocks in the world.
- Parameters
-
| moveStep | The move delta or velocity of the AABB. The components will be modified to reflect the collision response. |
| position | The position of the AABB feet. Based on this surrounding AABBs will be generated. |
| dt | The delta time since the last collision check. |
◆ tryStepUp()
| float AABBCollider::tryStepUp |
( |
const glm::vec3 & |
horizontalMove, |
|
|
const SweptResult & |
bestRes |
|
) |
| |
|
protected |
Attempts to step up when hitting a horizontal obstacle.
- Parameters
-
| horizontalMove | The horizontal movement vector on the colliding axis |
| collidingBB | The AABB that was collided with |
- Returns
- The step height if stepping is possible, -1.0f otherwise
◆ s_checkBox
| constexpr glm::vec3 engine::AABBCollider::s_checkBox {1.5f} |
|
staticconstexprprotected |
The box around the AABB that will be generated, thus checked for collisions against the world.
- Note
- This box is generated by taking the AABB and adding the amount of blocks in given direction to all sides.
The documentation for this class was generated from the following files: