PhysicsShape.h File Reference

Implements the PhysicsShape and PhysicsCompoundShape classes aswell as the Shape file format. More...

#include <vector>
#include "Math/Matrix.h"
#include "Math/Vector.h"
#include "Math/Point.h"
#include "Common/BaseTypes.h"

Classes

class  PhysicsShape
 Represents a single physics shape used for collision detections. More...
struct  PhysicsShape::PhysicsShapeData
 Holds all of the data needed to fully descibe a PhysicsShape. More...

Typedefs

typedef uint16 CollisionGroup
 Defines the group data type.

Functions

bool LoadShapeFromFile (const char *file, PhysicsCompoundShape &shape)
 Loads shape data from the specified shape file.

Variables

const CollisionGroup CG_GROUP1 = (CollisionGroup)BIT(1)
const CollisionGroup CG_GROUP2 = (CollisionGroup)BIT(2)
const CollisionGroup CG_GROUP3 = (CollisionGroup)BIT(3)
const CollisionGroup CG_GROUP4 = (CollisionGroup)BIT(4)
const CollisionGroup CG_GROUP5 = (CollisionGroup)BIT(5)
const CollisionGroup CG_GROUP6 = (CollisionGroup)BIT(6)
const CollisionGroup CG_GROUP7 = (CollisionGroup)BIT(7)
const CollisionGroup CG_GROUP8 = (CollisionGroup)BIT(8)
const CollisionGroup CG_GROUP9 = (CollisionGroup)BIT(9)
const CollisionGroup CG_GROUP10 = (CollisionGroup)BIT(10)
const CollisionGroup CG_GROUP11 = (CollisionGroup)BIT(11)
const CollisionGroup CG_GROUP12 = (CollisionGroup)BIT(12)
const CollisionGroup CG_GROUP13 = (CollisionGroup)BIT(13)
const CollisionGroup CG_GROUP14 = (CollisionGroup)BIT(14)
const CollisionGroup CG_GROUP15 = (CollisionGroup)BIT(15)
const CollisionGroup CG_GROUP16 = (CollisionGroup)BIT(16)
const CollisionGroup CG_ALL = (CollisionGroup)0xFFFF

Detailed Description

Implements the PhysicsShape and PhysicsCompoundShape classes aswell as the Shape file format.

Declares the PhysicsShape and PhysicsCompoundShape classes aswell as the Shape file format.

Author:
Joe Forte
Date:
3/18/2008

Function Documentation

bool LoadShapeFromFile ( const char *  file,
PhysicsCompoundShape &  shape 
)

Loads shape data from the specified shape file.

Parameters:
[in] file the path to shape file.
[out] shape the PhysicsCompoundShape that the shape data specified in file will be added to.
Returns:
True if the shape file was succesfully loaded, false otherwise.

Shape File format (*.shape) The shape file format is a simple human readable ASCII text file that describes one or more shapes. There are three shape types that can be defined as follows:

Circle shape: A circle can be defined by writing 'circle' followed by the radius 'r', the center positions 'x' and 'y' coordinates as follows:

circle r x y

Example: circle 5.0 0.0 0.0

Box shape: A box can be defined by writing 'box' followd by its width 'w', height 'h', its center position 'x' and 'y', its scale in the x and y direction 'sx' and 'sy' and its angle in radians 'a' as follows:

box w h x y sx sy a

Example: box 5.0 5.0 0.0 0.0 1.0 1.0 0.0

Polygon shape: A polygon can be defined by writing 'poly' followed by the number of vertices in the polygon 'n', the amount to translate the polygon 'tx' and 'ty', the amount to scale the polygon 'sx' and 'sy', the angle of the polygon 'a' and 'n' xy coordinate pairs for each verex in the polygon as follows:

poly n tx ty sx sy a x1 y1 x2 y2 ... xn yn

Example: poly 3 0.0 0.0 1.0 1.0 0.0 -1.0 -1.0 0.0 1.0 1.0 1.0

Shape file constrints:

  1. All angles are in radians, and all rotaions are done about the origin (0,0).
  2. Scaling factors do not have tobe uniform but they can never equal 0.
  3. The number of vertecies in a polygon is constrained to PSHAPE_POLY_MAX_VERTS (currently set to 8).
  4. Vertices must be in Counter Clockwise Winding Order.
  5. An arbitrary number of shapes can be defined in one shape file. Note that performance may be hindered by a large number of shapes.

Variable Documentation

All possible collision groups

Group 1. The default group objects belong to and collide with.

Group 10

Group 11

Group 12

Group 13

Group 14

Group 15

Group 16

Group 2

Group 3

Group 4

Group 5

Group 6

Group 7

Group 8

Group 9

Generated on Mon Apr 5 19:08:05 2010 for BrickOut |ReDuX| by  doxygen 1.6.3