Bowls
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
Physics Namespace Reference

Physics functions. More...

Functions

float distanceBetweenTwoSpheres (cgg::Vec3 sphere1Pos, cgg::Vec3 sphere2Pos)
 
bool collisionCheck (Ball *sphere1, Ball *sphere2, float dt)
 
bool collisionCheck (Ball *sphere, Box *wall, float dt)
 
void newCollisionVelocities (Ball *sphere1, Ball *sphere2)
 
void newCollisionVelocities (Ball *sphere, Box *wall)
 
void applyFriction (Ball *sphere)
 
float kinectInputVelocity (float distance, float time)
 

Detailed Description

Physics functions.

A Namespace that contains functions for the physics in the game. Code by Jamie Slowgrove

Function Documentation

void Physics::applyFriction ( Ball sphere)

Applies Friction to the sphere

Takes in the sphere and adds friction to its velocities

Parameters
Ball*the sphere to be updated
bool Physics::collisionCheck ( Ball sphere1,
Ball sphere2,
float  dt 
)

Checks if 2 spheres collide

Takes in two spheres and a delta time and uses this to detect if the spheres collide

Parameters
Ball*one of the spheres to be used in the collision
Ball*one of the spheres to be used in the collision
floatthe current delta time
Returns
bool if the collision occurs
bool Physics::collisionCheck ( Ball sphere,
Box wall,
float  dt 
)

Checks if a sphere collides with a wall

Takes in a sphere, a wall and a delta time and uses this to detect if the two collide

Parameters
Ball*the sphere to be used in the collision
Box*the wall to be used in the collision
floatthe current delta time
Returns
bool if the collision occurs
float Physics::distanceBetweenTwoSpheres ( cgg::Vec3  sphere1Pos,
cgg::Vec3  sphere2Pos 
)

Works out the distance between two spheres

Takes in two sphere positions and works out the distance between them

Parameters
cgg::Vec3one of the position of the spheres to be used in the collision
cgg::Vec3one of the position of the spheres to be used in the collision
floatthe current delta time
Returns
bool if the collision occurs
float Physics::kinectInputVelocity ( float  distance,
float  time 
)

Works out the velocity from the kinect input

Takes in the change in distance and change in time from the kinect output and converts it to a velocity

Parameters
floatthe change in distance
floatthe change in time
Returns
float the calculated velocity
void Physics::newCollisionVelocities ( Ball sphere1,
Ball sphere2 
)

Works out the new velocities after the spheres collide

Takes in two spheres works out the new velocities of the spheres

Parameters
Ball*one of the spheres to be updated
Ball*one of the spheres to be updated
void Physics::newCollisionVelocities ( Ball sphere,
Box wall 
)

Works out the new velocities after the sphere collides with a wall

Takes in the sphere and wall and works out the new velocities of the sphere

Parameters
Ball*the sphere to be updated
Box*the wall it has collided with