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"
Implements the PhysicsShape and PhysicsCompoundShape classes aswell as the Shape file format.
Declares the PhysicsShape and PhysicsCompoundShape classes aswell as the Shape file format.
bool LoadShapeFromFile | ( | const char * | file, | |
PhysicsCompoundShape & | shape | |||
) |
Loads shape data from the specified shape file.
[in] | file | the path to shape file. |
[out] | shape | the PhysicsCompoundShape that the shape data specified in file will be added to. |
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:
const CollisionGroup CG_ALL = (CollisionGroup)0xFFFF |
All possible collision groups
const CollisionGroup CG_GROUP1 = (CollisionGroup)BIT(1) |
Group 1. The default group objects belong to and collide with.
const CollisionGroup CG_GROUP10 = (CollisionGroup)BIT(10) |
Group 10
const CollisionGroup CG_GROUP11 = (CollisionGroup)BIT(11) |
Group 11
const CollisionGroup CG_GROUP12 = (CollisionGroup)BIT(12) |
Group 12
const CollisionGroup CG_GROUP13 = (CollisionGroup)BIT(13) |
Group 13
const CollisionGroup CG_GROUP14 = (CollisionGroup)BIT(14) |
Group 14
const CollisionGroup CG_GROUP15 = (CollisionGroup)BIT(15) |
Group 15
const CollisionGroup CG_GROUP16 = (CollisionGroup)BIT(16) |
Group 16
const CollisionGroup CG_GROUP2 = (CollisionGroup)BIT(2) |
Group 2
const CollisionGroup CG_GROUP3 = (CollisionGroup)BIT(3) |
Group 3
const CollisionGroup CG_GROUP4 = (CollisionGroup)BIT(4) |
Group 4
const CollisionGroup CG_GROUP5 = (CollisionGroup)BIT(5) |
Group 5
const CollisionGroup CG_GROUP6 = (CollisionGroup)BIT(6) |
Group 6
const CollisionGroup CG_GROUP7 = (CollisionGroup)BIT(7) |
Group 7
const CollisionGroup CG_GROUP8 = (CollisionGroup)BIT(8) |
Group 8
const CollisionGroup CG_GROUP9 = (CollisionGroup)BIT(9) |
Group 9