initialization and handling of collisions and raycast basically everything that is released to or uses the ReactPhysics3D library
More...
#include <CollisionManager.h>
|
| CollisionManager () |
| constructor calls Init() More...
|
|
void | Init () |
| initialization creates collision world, creates player collision box, adds collision to rooms and targets and initializes hit visualization More...
|
|
void | Cleanup () |
| destroy everything related to ReactPhysics3D (RP3D), as doing it in the destructor is too late. As part of a global object, it gets called to late More...
|
|
void | CheckCollision (glm::vec3 currentPosition) |
| checks collision between objects and uses callback for notification More...
|
|
void | CheckOverlap (glm::vec3 currentPosition) |
| checks for overlaps between collision bodies as collision checks are quite expensive, for regular collision detection, overlap checks are enough More...
|
|
glm::vec3 | GetCurrentMeanNormalOfContactPoints () |
| calculates mean normal of all contact points depending on the size of the collision shapes, RP3D return multiple contact points and in case of multiple shapes, with different normals. In an attempt to stop the player from glitching through corners, a mean normal is calcualted and used for sliding along walls More...
|
|
void | RayCast (glm::vec3 start, glm::vec3 dir) |
| triggers raycast default length is used More...
|
|
void | RayCast (rp3d::Vector3 start, rp3d::Vector3 dir) |
| triggers raycast default length is used More...
|
|
rp3d::CollisionWorld * | CollisionWorld () |
| Gets pointer to the current collision world. More...
|
|
bool | DrawHits () |
| get value whethere hits are visualized or not More...
|
|
RaycastCallback | GetRaycastCallback () |
| Gets the current raycast callback object. More...
|
|
size_t | HitModelId () |
| Gets the model id of the model used for hit visualization. More...
|
|
void | ResetContactPoints () |
| clears the list of contact points More...
|
|
void | ClearHits () |
| clears list of registered hits More...
|
|
initialization and handling of collisions and raycast basically everything that is released to or uses the ReactPhysics3D library
◆ CollisionManager()
skr::fps2::Collision::CollisionManager::CollisionManager |
( |
| ) |
|
◆ AddCollisionToRooms()
void skr::fps2::Collision::CollisionManager::AddCollisionToRooms |
( |
| ) |
|
|
private |
Adds collision to all walls and targets in all rooms.
◆ AddCollisionToTarget()
adds collision boxes to all targest in a specified room
◆ AddCollisionToTargets()
void skr::fps2::Collision::CollisionManager::AddCollisionToTargets |
( |
| ) |
|
|
private |
adds collision to all targets in all rooms
◆ AddCollissionWallToRoom()
adds collision walls to specified room
- Parameters
-
rg | RoomGeomtry of room specified |
◆ CheckCollision()
void skr::fps2::Collision::CollisionManager::CheckCollision |
( |
glm::vec3 |
currentPosition | ) |
|
checks collision between objects and uses callback for notification
- Parameters
-
currentPosition | current Position of the player |
◆ CheckOverlap()
void skr::fps2::Collision::CollisionManager::CheckOverlap |
( |
glm::vec3 |
currentPosition | ) |
|
checks for overlaps between collision bodies as collision checks are quite expensive, for regular collision detection, overlap checks are enough
- Parameters
-
currentPosition | current Position of the player |
◆ Cleanup()
void skr::fps2::Collision::CollisionManager::Cleanup |
( |
| ) |
|
destroy everything related to ReactPhysics3D (RP3D), as doing it in the destructor is too late. As part of a global object, it gets called to late
◆ ClearHits()
void skr::fps2::Collision::CollisionManager::ClearHits |
( |
| ) |
|
clears list of registered hits
◆ CollisionWorld()
rp3d::CollisionWorld * skr::fps2::Collision::CollisionManager::CollisionWorld |
( |
| ) |
|
Gets pointer to the current collision world.
- Returns
- pointer to collision world
◆ DrawHits()
bool skr::fps2::Collision::CollisionManager::DrawHits |
( |
| ) |
|
get value whethere hits are visualized or not
- Returns
- true if hits are visualized, otherwise false
◆ GetCurrentMeanNormalOfContactPoints()
glm::vec3 skr::fps2::Collision::CollisionManager::GetCurrentMeanNormalOfContactPoints |
( |
| ) |
|
calculates mean normal of all contact points depending on the size of the collision shapes, RP3D return multiple contact points and in case of multiple shapes, with different normals. In an attempt to stop the player from glitching through corners, a mean normal is calcualted and used for sliding along walls
- Returns
- mean normal of all contact points
◆ GetRaycastCallback()
RaycastCallback skr::fps2::Collision::CollisionManager::GetRaycastCallback |
( |
| ) |
|
Gets the current raycast callback object.
- Returns
- raycast callback object
◆ HitModelId()
size_t skr::fps2::Collision::CollisionManager::HitModelId |
( |
| ) |
|
Gets the model id of the model used for hit visualization.
- Returns
- model id of the model used for hit visualization
◆ Init()
void skr::fps2::Collision::CollisionManager::Init |
( |
| ) |
|
initialization creates collision world, creates player collision box, adds collision to rooms and targets and initializes hit visualization
◆ RayCast() [1/2]
void skr::fps2::Collision::CollisionManager::RayCast |
( |
glm::vec3 |
start, |
|
|
glm::vec3 |
dir |
|
) |
| |
triggers raycast default length is used
- Parameters
-
start | current point of the player, where the raycasts starte |
dir | of the raycast |
◆ RayCast() [2/2]
void skr::fps2::Collision::CollisionManager::RayCast |
( |
rp3d::Vector3 |
start, |
|
|
rp3d::Vector3 |
dir |
|
) |
| |
triggers raycast default length is used
- Parameters
-
start | current point of the player, where the raycasts starte |
dir | of the raycast |
◆ ResetContactPoints()
void skr::fps2::Collision::CollisionManager::ResetContactPoints |
( |
| ) |
|
clears the list of contact points
◆ _collisionCallback
◆ _collisionWorld
rp3d::CollisionWorld* skr::fps2::Collision::CollisionManager::_collisionWorld |
|
private |
◆ _drawHits
bool skr::fps2::Collision::CollisionManager::_drawHits = true |
|
private |
value specifying whether hits are visualized. Default true
◆ _hitModelId
size_t skr::fps2::Collision::CollisionManager::_hitModelId |
|
private |
model id of model for hit visualization
◆ _overlapCallback
collision callback object
◆ _playerBox
CollisionBox skr::fps2::Collision::CollisionManager::_playerBox |
|
private |
collisionbox of the player
◆ _raycastCallback
The documentation for this class was generated from the following files: