PGR Copakond OpenGL Engine - Bowling
Loading...
Searching...
No Matches
copakond::RigidSphere Class Reference

Kinematic sphere that automatically rolls based on its horizontal velocity. More...

#include <rigidSphere.h>

Inheritance diagram for copakond::RigidSphere:
copakond::CollisionSphere copakond::CollisionShape copakond::Mesh copakond::Geometry

Public Member Functions

 RigidSphere (const glm::vec3 &position=glm::vec3(0.0f), const glm::vec3 &rotation=glm::vec3(0.0f), const glm::vec3 &scale=glm::vec3(1.0f), bool debug=false)
void physics_process (float deltaTime, const std::vector< CollisionShape * > &allColliders)
 Updates position, applies gravity, friction, rolling, and resolves collisions.
glm::vec3 & velocity ()
glm::vec3 & gravity ()
void setAirFriction (float airFriction)
float getAirFriction () const
bool isOnFloor () const
Public Member Functions inherited from copakond::CollisionSphere
 CollisionSphere (const glm::vec3 &position=glm::vec3(0.0f), const glm::vec3 &rotation=glm::vec3(0.0f), const glm::vec3 &scale=glm::vec3(1.0f), bool visible=false)
void init (GLuint shader) override
 Initializes OpenGL buffers (VAO, VBO) for the mesh.
bool collisionCheck (const CollisionShape &mesh, glm::vec3 velocity=glm::vec3(0.0f)) override
 Fast boolean check if this shape intersects with another.
CollisionResult collisionCheckDetailed (const CollisionShape &mesh, glm::vec3 velocity, bool calculateNormal=false) override
 Detailed collision check returning overlap status, normal, and reflection vectors.
Public Member Functions inherited from copakond::CollisionShape
 CollisionShape (const glm::vec3 &position=glm::vec3(0.0f), const glm::vec3 &rotation=glm::vec3(0.0f), const glm::vec3 &scale=glm::vec3(1.0f), bool visible=false)
void draw (float deltaTime) override
void enable ()
void disable ()
bool isEnabled () const
Public Member Functions inherited from copakond::Mesh
 Mesh ()
 Mesh (const glm::vec3 &position)
 Mesh (const glm::vec3 &position, const glm::vec3 &rotation)
 Mesh (const glm::vec3 &position, const glm::vec3 &rotation, const glm::vec3 &scale)
virtual ~Mesh ()
void setVertices (const std::vector< float > &vertices)
void setMaterial (const std::shared_ptr< Material > &material)
 Applies a material to the entire mesh and all its submeshes.
const std::vector< SubMesh > & getSubMeshes () const
std::shared_ptr< MaterialgetMaterial ()
GLuint getVao () const
GLsizei getNumVertices () const
int getId () const
void setVertexWave (bool isVertexWave)
bool isVertexWave () const
void hide ()
void show ()
void setVisible (bool visible)
bool isVisible () const
Public Member Functions inherited from copakond::Geometry
 Geometry ()
 Geometry (const glm::vec3 &position)
 Geometry (const glm::vec3 &position, const glm::vec3 &rotation)
 Geometry (const glm::vec3 &position, const glm::vec3 &rotation, const glm::vec3 &scale)
virtual ~Geometry ()
virtual void setPosition (const glm::vec3 &position)
virtual void setRotation (const glm::vec3 &rotation)
virtual void setScale (const glm::vec3 &scale)
virtual void setRotationDegrees (const glm::vec3 &rotationDegrees)
glm::mat4 getRotationXMatrix () const
glm::mat4 getRotationYMatrix () const
glm::mat4 getRotationZMatrix () const
glm::mat4 getPositionMatrix () const
glm::mat4 getRotationMatrix () const
glm::mat4 getScaleMatrix () const
glm::mat4 getModelMatrix () const
 Calculates local transformation matrix.
glm::mat4 getWorldPositionMatrix () const
glm::mat4 getWorldRotationMatrix () const
glm::mat4 getWorldScaleMatrix () const
glm::mat4 getWorldModelMatrix () const
 Calculates global transformation matrix by multiplying all ancestor matrices.
glm::vec3 getPosition () const
glm::vec3 getRotation () const
glm::vec3 getScale () const
glm::vec3 getRotationDegrees () const
glm::vec3 getWorldPosition () const
glm::vec3 getWorldRotation () const
glm::vec3 getWorldScale () const
glm::vec3 & position ()
glm::vec3 & rotation ()
glm::vec3 & scale ()
glm::vec3 worldPosition () const
glm::vec3 worldRotation () const
glm::vec3 worldScale () const
bool setParent (Geometry *newParent)
 Attaches this object to a new parent in the scene graph.
GeometrygetParent () const
std::vector< Geometry * > getChildren () const

Additional Inherited Members

Public Attributes inherited from copakond::CollisionShape
ShapeType shapeType
PhysicsMaterial physicsMaterial = PhysicsMaterial()
Protected Member Functions inherited from copakond::CollisionShape
void _generateGeometry (GLuint shader, const std::vector< float > &vertices, const std::vector< float > &normals)
Protected Member Functions inherited from copakond::Mesh
void _SetId ()
Protected Attributes inherited from copakond::CollisionShape
bool _enabled = true
Protected Attributes inherited from copakond::Mesh
int id
int _isVertexWave = false
bool _visible = true
GLuint _shaderProgram = 0
GLuint _vboVertices = 0
GLuint _vboNormals = 0
GLuint _vao = 0
GLsizei _numVertices = 0
std::vector< float > _vertices = std::vector<float>()
std::shared_ptr< Material_material = std::make_shared<Material>()
std::vector< SubMesh_subMeshes
Protected Attributes inherited from copakond::Geometry
Geometryparent = nullptr
std::vector< Geometry * > children
glm::vec3 _position
glm::vec3 _rotation
glm::vec3 _scale
Static Protected Attributes inherited from copakond::Mesh
static int globalMeshCounter = 0

Detailed Description

Kinematic sphere that automatically rolls based on its horizontal velocity.

Constructor & Destructor Documentation

◆ RigidSphere()

copakond::RigidSphere::RigidSphere ( const glm::vec3 & position = glm::vec3(0.0f),
const glm::vec3 & rotation = glm::vec3(0.0f),
const glm::vec3 & scale = glm::vec3(1.0f),
bool debug = false )

Member Function Documentation

◆ getAirFriction()

float copakond::RigidSphere::getAirFriction ( ) const
inline

◆ gravity()

glm::vec3 & copakond::RigidSphere::gravity ( )
inline

◆ isOnFloor()

bool copakond::RigidSphere::isOnFloor ( ) const
inline

◆ physics_process()

void copakond::RigidSphere::physics_process ( float deltaTime,
const std::vector< CollisionShape * > & allColliders )

Updates position, applies gravity, friction, rolling, and resolves collisions.

◆ setAirFriction()

void copakond::RigidSphere::setAirFriction ( float airFriction)

◆ velocity()

glm::vec3 & copakond::RigidSphere::velocity ( )
inline

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