PCG-FPS  v2 m0.22.4
Simple First Person Shooter with Procedurally Generated Level
Public Member Functions | Public Attributes | Private Attributes | List of all members
skr::fps2::Collision::CollisionBox Class Reference

defines a box used to collision More...

#include <CollisionBox.h>

Public Member Functions

 CollisionBox ()
 Default constructor initiliazes all pointers as null_ptr. More...
 
 CollisionBox (rp3d::CollisionWorld *world, rp3d::Vector3 position, rp3d::Vector3 size, CollisionCategory category=CollisionCategory::WALL)
 constructor More...
 
CollisionCategory GetCollisionCategory ()
 returns the collision categories of this box More...
 
void SetCollisionCatergory (CollisionCategory category)
 sets CollisionCategory using the enum More...
 
void SetCollisionCatergory (unsigned short category)
 set CollisionCategory using indices for enum More...
 
void UpdatePosition (glm::vec3 pos)
 Updates position of this CollisionBox as glm vec3. More...
 
void UpdatePosition (rp3d::Vector3 pos)
 Updates position of this CollisionBox as rp3d vector3. More...
 
void DrawCollisionShape (skr::fps2::Renderer::OpenGL::Shader shader, glm::mat4 view, glm::mat4 proj, glm::mat4 model, glm::vec3 color=glm::vec3(1.0f, 0.0f, 0.0f)) const
 Draws the collision shape. More...
 

Public Attributes

rp3d::CollisionWorld * _world
 RP3D collision world. More...
 
rp3d::CollisionBody * _body
 collision body of the box More...
 
rp3d::CollisionShape * _shape
 shape of the collision object More...
 
rp3d::ProxyShape * _proxyShape
 proxy shape of the collision object More...
 
glm::vec3 _position
 position More...
 

Private Attributes

BoundingBox _boundingBox
 bounding box of the collision shape More...
 

Detailed Description

defines a box used to collision

Constructor & Destructor Documentation

◆ CollisionBox() [1/2]

skr::fps2::Collision::CollisionBox::CollisionBox ( )

Default constructor initiliazes all pointers as null_ptr.

◆ CollisionBox() [2/2]

skr::fps2::Collision::CollisionBox::CollisionBox ( rp3d::CollisionWorld *  world,
rp3d::Vector3  position,
rp3d::Vector3  size,
CollisionCategory  category = CollisionCategory::WALL 
)

constructor

Parameters
worldRP3D collision world
positionPosition of the CollisionBox
sizeSize of the CollisionBox
categoryCollision Categories the CollisionBox has. Default: Wall

Member Function Documentation

◆ DrawCollisionShape()

void skr::fps2::Collision::CollisionBox::DrawCollisionShape ( skr::fps2::Renderer::OpenGL::Shader  shader,
glm::mat4  view,
glm::mat4  proj,
glm::mat4  model,
glm::vec3  color = glm::vec3(1.0f, 0.0f, 0.0f) 
) const

Draws the collision shape.

Parameters
shaderShader used to draw
viewView Matrix
projProjection Matrix
modelModel Matrix
colorColor to draw the collision shape with. Default: Red (1,0,0)

◆ GetCollisionCategory()

CollisionCategory skr::fps2::Collision::CollisionBox::GetCollisionCategory ( )

returns the collision categories of this box

Returns
CollisionCategory of this box

◆ SetCollisionCatergory() [1/2]

void skr::fps2::Collision::CollisionBox::SetCollisionCatergory ( CollisionCategory  category)

sets CollisionCategory using the enum

Parameters
categorycategory enum

◆ SetCollisionCatergory() [2/2]

void skr::fps2::Collision::CollisionBox::SetCollisionCatergory ( unsigned short  category)

set CollisionCategory using indices for enum

Parameters
categoryCollisionCategorie inidices for enum

◆ UpdatePosition() [1/2]

void skr::fps2::Collision::CollisionBox::UpdatePosition ( glm::vec3  pos)

Updates position of this CollisionBox as glm vec3.

Parameters
posnew Position

◆ UpdatePosition() [2/2]

void skr::fps2::Collision::CollisionBox::UpdatePosition ( rp3d::Vector3  pos)

Updates position of this CollisionBox as rp3d vector3.

Parameters
posnew Position

Member Data Documentation

◆ _body

rp3d::CollisionBody* skr::fps2::Collision::CollisionBox::_body

collision body of the box

◆ _boundingBox

BoundingBox skr::fps2::Collision::CollisionBox::_boundingBox
private

bounding box of the collision shape

◆ _position

glm::vec3 skr::fps2::Collision::CollisionBox::_position

position

◆ _proxyShape

rp3d::ProxyShape* skr::fps2::Collision::CollisionBox::_proxyShape

proxy shape of the collision object

◆ _shape

rp3d::CollisionShape* skr::fps2::Collision::CollisionBox::_shape

shape of the collision object

◆ _world

rp3d::CollisionWorld* skr::fps2::Collision::CollisionBox::_world

RP3D collision world.


The documentation for this class was generated from the following files: