blaze.collision.shapes.shape



struct MassData ;
This holds the mass data computed for a shape.

float mass ;
The mass of the shape, usually in kilograms.

bVec2 center ;
The position of the shape's centroid relative to the shape's origin.

float I ;
The rotational inertia of the shape.

struct FilterData ;
This holds contact filtering data. Use FilterData to fine-tune which objects collide against which others

uint categoryBits ;
The collision category bits. Normally you would just set one bit.

uint maskBits ;
The collision mask bits. This states the categories that this shape would accept for collision.

uint groupIndex ;
Collision groups allow a certain group of objects to never collide (negative) or always collide (positive). Zero means no collision group. Non-zero group filtering always wins against the mask bits.

An example of this may be a set of snowflake particles. It would be wasteful to try to detect collisions between snowflakes.

enum SegmentCollide ;
Return codes from TestSegment

STARTS_INSIDE
The segment starts inside the shape being tested

MISS
The segment missed the shape

HIT
The segment hit the shape

class ShapeDef ;
A shape definition is used to construct a shape. This class defines an abstract shape definition. You can reuse shape definitions safely.

this();
The constructor sets the default shape definition values.

Body rBody ;
The Body this shape belongs to

ShapeType type ;
Holds the shape type for down-casting.

Object userData ;
Use this to store application specify shape data.

float friction ;
The shape's friction coefficient, usually in the range [0,1].

float restitution ;
The shape's restitution (elasticity) usually in the range [0,1]. Set this to greater than 1 for some silly results.

float density ;
The shape's density , usually in kilograms per square meter.

bool isSensor ;
A sensor shape collects contact information but never generates a collision response. Examples of this sort of shape would be a goal, a trap sensor, a teleporter, or something similar.

FilterData filter ;
Contact filtering data.

void setAsBox (float hx, float hy);
BUGS:
Not implemented

class Shape ;
A shape is used for collision detection. Shapes are created in World. You can use shape for collision detection before they are attached to the world.

Warning:
you cannot reuse shapes.

float sweepRadius ();
Returns:
the maximum radius about the parent body's center of mass.

ShapeType type ();
Get the type of this shape. You can use this to down cast to the concrete shape.

Returns:
the shape type .

BUGS:
Is this really necessary in D?

bTri2 [] triangleList ();
Get the shape's triangle list. Vertices are in world coordinates

Returns:
the triangle list.

bool isSensor ();
Is this shape a sensor (non-solid)?

Returns:
true if the shape is a sensor, false otherwise

float ymax ();
Returns:
the AABB y upper bound

float ymin ();
Returns:
the AABB y lower bound

float xmax ();
Returns:
AABB x maximum bound

float xmin ();
Returns:
AABB x minimum bound

this(ShapeDef def);
Shape definition Constructor

Params:
ShapeDef def the shape definition

this();
Generic constructor (Used by FluidParticles). Does nothing

bool synchronize (bXForm transform1, bXForm transform2);
I don't really know what this is for. All it does is call computeSweptAABB and then returns false.

BUGS:
Why does this always returns false?

See Also:
dsource.org/projects/blaze/ticket/4

void refilterProxy (BroadPhase broadPhase, bXForm transform);
BUGS:
Not implemented

abstract bool testPoint (bXForm xf, bVec2 p);
Test a point for containment in this shape. This only works for convex shapes.

Params:
bXForm xf the shape world transform.
bVec2 p a point in world coordinates.

Returns:
true if the point lies within the shape, false otherwise.

abstract SegmentCollide testSegment (bXForm xf, ref float lambda, ref bVec2 normal, Segment segment, float maxLambda);
Perform a ray cast against this shape.

Params:
bXForm xf the shape world transform.
float lambda returns the hit fraction. You can use this to compute the contact point p = (1 - lambda) * segment.p1 + lambda * segment.p2
bVec2 normal returns the normal at the contact point. If there is no intersection, the normal is not set.
Segment segment defines the begin and end point of the ray cast.
float maxLambda a number typically in the range [0,1].

Returns:
a SegmentCollide representing the collision between this shape and the segment

abstract void computeAABB (ref AABB aabb, bXForm xf);
Given a transform, compute the associated axis aligned bounding box for this shape. This does not modify the shape's AABB

Params:
AABB aabb returns the axis aligned box.
bXForm xf the world transform of the shape.

abstract void updateAABB ();
Update the AABB

abstract AABB aabb ();
Returns:
the axis aligned bounding box associated with the shape, in reference to the parent body's transform

abstract void updateSweepRadius (bVec2 center);
Update the sweep radius (maximum radius) as measured from a local center point.

Params:
bVec2 center the center point to measure from

abstract void computeSweptAABB (bXForm xf1, bXForm xf2);
Given two transforms, compute the associated swept axis aligned bounding box for this shape. This DOES modify the shape's AABB (see bugs)

Params:
bXForm xf1 the world transform of the shape.
bXForm xf2 the velocity of the shape

BUGS:
Why is this different from the way Box2d does it? And why does it behave differently from computeAABB?

abstract void computeMass (ref MassData massData);
Compute the mass properties of this shape using its dimensions and density. The inertia tensor is computed about the local origin, not the centroid.

Params:
MassData massData returns the mass data for this shape.

void triangulate ();
Triangulate the shape in world coordinates. Currently this is only used by the buoyancy solver.

BUGS:
Shouldn't this be made abstract?

abstract bVec2 worldCenter ();
The shape's world center

abstract bVec2 support (bXForm xf, bVec2 d);
Returns:
The shape's support point (for MPR & GJK)

static Shape create (ShapeDef def);
Creates a shape from a definition. Automatically calls the correct constructor for the shape specified in the definition Params def = the shape definition

Object userData ;
User data. This can be anything that you want to have connected to the shape. Often this is a reference back to the game object associated with the shape. Use this inside collision callbacks to refer to your game object.

float area ;
The shape's area (Usually square meters)

float friction ;
The shape's friction

float restitution ;
The shape's coefficient of restitution

Shape next ;
The next shape in the shape list

Body rBody ;
The body this shape is attached to

FilterData filter ;
Information for contact filtering

ushort ID ;
This shapes identifier

Page was generated with on Tue Feb 10 19:13:09 2009