Rune Engine  Version 0.2.7-alpha
Documentation for how to make games using the Rune Engine.
physics Namespace Reference

The physics module responsible for handling and resolving collisions between physics::Collider2D. More...

Classes

struct  AABB
 Axis aligned bounding box for each object. More...
 
struct  body
 Rigid body struct containing all the information for a physically realistic response. More...
 
class  BoxCollider
 
class  CircleCollider
 
class  Collider
 A collider that is to be used for registering collisions between objects in the scene. More...
 
struct  collision
 Collision manifold used for reporting rigid body collisions. More...
 
class  RigidBody
 Game object component that allows a game object to have collisions with other objects. More...
 
class  World
 A physics world that contains all the information needed to run physics. More...
 

Functions

void updatePhysics (std::vector< physics::RigidBody * > objects, double dT)
 Function call made by the game scene to have objects get updated. More...
 
std::vector< physics::collisionbroadPhaseCollisions (std::vector< physics::RigidBody * > boundingBoxes)
 Broad phase collision responsible for determining collisions based off of AABB's only.
 
std::vector< physics::collisionnarrowPhaseCollisions (std::vector< physics::collision > possibleCollisions)
 Narrow phase collision responsible for determining if a possible collision is actually a collision after taking rotation into account.
 
void resolveCollisions (std::vector< physics::collision > currentCollision)
 Resolve the definite collisions in a physically realistic way. More...
 
void positionalCorrection (physics::RigidBody *object1, physics::RigidBody *object2, double penetration, rune::Vec2 normal)
 Correct the position of the object each frame so that it doesn't look like two objects are overlapping. More...
 
double pythagoreanSolve (double a, double b)
 Solve for the hypotenuse given the two sides of a triangle. More...
 

Detailed Description

The physics module responsible for handling and resolving collisions between physics::Collider2D.

Author
Thomas Montano
Date
March 2 2020

Function Documentation

◆ positionalCorrection()

void physics::positionalCorrection ( physics::RigidBody object1,
physics::RigidBody object2,
double  depth,
rune::Vec2  normal 
)

Correct the position of the object each frame so that it doesn't look like two objects are overlapping.

Parameters
object1The first object in the collision.
object2The seconds object in the collision.
depthThe penetration depth in world coordinates.
normalThe normal vector for the collision.

◆ pythagoreanSolve()

double physics::pythagoreanSolve ( double  a,
double  b 
)

Solve for the hypotenuse given the two sides of a triangle.

Parameters
aFirst side of the triangle.
bSeconds side of the triangle.
Returns
The length of the hypotenuse.

◆ resolveCollisions()

void physics::resolveCollisions ( std::vector< physics::collision collisions)

Resolve the definite collisions in a physically realistic way.

Parameters
collisionsCollision manifolds for OBB's that were found to be definitely colliding.

◆ updatePhysics()

void physics::updatePhysics ( std::vector< physics::RigidBody * >  objects,
double  dT 
)

Function call made by the game scene to have objects get updated.

Parameters
objectsAn array of pointers to rigid bodies that should be considered for collision
dTThe amount of time that the physics frame occupies