Colliding Shapes
Ian Parberry's "Introduction to Game Physics"
|
Kinematic line segment shape. More...
#include <LineSeg.h>
Public Member Functions | |
CKinematicLineSeg (CLineSegDesc &) | |
Constructor. More... | |
void | Rotate (const Vector2 &, float) |
Rotate. More... | |
void | Reset () |
Reset orientation. More... | |
Public Member Functions inherited from CLineSeg | |
CLineSeg (CLineSegDesc &) | |
Constructor. More... | |
bool | PreCollide (CContactDesc &) |
Collision detection. More... | |
void | GetEndPts (Vector2 &, Vector2 &) |
Get end points. More... | |
void | GetTangents (Vector2 &, Vector2 &) |
Get tangents. More... | |
const Vector2 & | GetNormal () |
Get normal. More... | |
Public Member Functions inherited from CLine | |
CLine (const Vector2 &, float) | |
Constructor. More... | |
Public Member Functions inherited from CShape | |
CShape (const CShapeDesc &) | |
Constructor. More... | |
virtual | ~CShape () |
Destructor. More... | |
const eShape | GetShapeType () const |
Get shape type. More... | |
const eMotion | GetMotionType () const |
Get motion type. More... | |
const CAabb2D & | GetAABB () const |
Get AABB. More... | |
const bool | GetSensor () const |
Is this shape a sensor? More... | |
const Vector2 & | GetPos () const |
Get position. More... | |
void | SetPos (const Vector2 &) |
Set position. More... | |
void | SetAABBPoint (const Vector2 &) |
Set AABB point. More... | |
void | AddAABBPoint (const Vector2 &) |
Add AABB point. More... | |
void | SetCanCollide (bool=true) |
Turn collisions on or off. More... | |
const bool | GetCanCollide () const |
Get whether shape can collide. More... | |
virtual void | move () |
Translate. More... | |
const bool | GetRotating () const |
Get whether rotating. More... | |
void | SetRotating (bool) |
Start or stop rotating. More... | |
const float | GetOrientation () const |
Get orientation. More... | |
const float | GetRotSpeed () const |
Get rotation speed. More... | |
const Vector2 & | GetRotCenter () const |
Get rotation speed. More... | |
const float | GetElasticity () const |
Get elasticity. More... | |
void | SetOrientation (float) |
Set orientation. More... | |
void | SetRotSpeed (float) |
Set rotation speed. More... | |
void | SetRotCenter (const Vector2 &) |
Set center of rotation. More... | |
void * | GetUserPtr () const |
Get user pointer. More... | |
void | SetUserPtr (void *) |
Set user pointer. More... | |
Private Attributes | |
Vector2 | m_vOldPt0 |
Old point 0. | |
Vector2 | m_vOldPt1 |
Old point 1. | |
Additional Inherited Members | |
Protected Member Functions inherited from CLineSeg | |
void | Update () |
Update other properties from the end points. More... | |
Protected Member Functions inherited from CLine | |
Vector2 | Intersect (const CLine &) |
Get intersection point with line. More... | |
Vector2 | ClosestPt (const Vector2 &) |
Get closest point on line. More... | |
Protected Attributes inherited from CLineSeg | |
Vector2 | m_vPt0 |
Point at end of line segment. | |
Vector2 | m_vPt1 |
Point at other end of line segment. | |
Vector2 | m_vTangent0 |
Tangent at point 0. | |
Vector2 | m_vTangent1 |
Tangent at point 1. | |
Vector2 | m_vNormal |
Normal to line segment. | |
Protected Attributes inherited from CLine | |
float | m_fGradient = 0.0f |
Gradient. | |
float | m_fInverseGradient = 0.0f |
Inverse gradient. | |
float | m_fYIntercept = 0.0f |
Intercept with Y axis. | |
float | m_fXIntercept = 0.0f |
Intercept with X axis. | |
Protected Attributes inherited from CShape | |
eShape | m_eShapeType = eShape::Unknown |
Type of shape. | |
eMotion | m_eMotionType = eMotion::Static |
How shape moves. | |
float | m_fElasticity = 1.0f |
Elasticity, aka restitution, bounciness. | |
bool | m_bIsSensor = false |
Sensor only, no rebound on collision. | |
CAabb2D | m_cAABB |
Axially aligned bounding box in World Space. | |
bool | m_bCanCollide = true |
Can collide with other shapes. | |
float | m_fOrientation = 0.0f |
Orientation angle. | |
void * | m_pUser |
Spare pointer for user in case they might need one. | |
Vector2 | m_vRotCenter |
Center of rotation. | |
float | m_fRotSpeed = 0.0f |
Rotation speed. | |
bool | m_bRotating = false |
Whether rotating. | |
Static Protected Attributes inherited from CShapeCommon | |
static float | m_fGravity = 0.0f |
Gravitational constant. | |
static float | m_fTimeStep = 0.0f |
Time step per animation frame (fictional). | |
A line segment whose motion type is KINEMATIC.
CKinematicLineSeg::CKinematicLineSeg | ( | CLineSegDesc & | r | ) |
Constructs a kinematic line segment described by an line segment descriptor.
r | Line segment descriptor. |
|
virtual |
Reset to original orientation.
Reimplemented from CShape.
|
virtual |
Rotate to a given orientation from original orientation.
v | Center of rotation. |
a | Angle increment from original orientation. |
Reimplemented from CShape.