MezzanineEngine March 18, 2012

Mezzanine::CollisionShape Class Reference

This is the base class for all collision shapes. More...

#include <collisionshape.h>

Inheritance diagram for Mezzanine::CollisionShape:
Mezzanine::CompoundCollisionShape Mezzanine::FieldCollisionShape Mezzanine::MeshCollisionShape Mezzanine::PrimitiveCollisionShape Mezzanine::HeightfieldCollisionShape Mezzanine::PlaneCollisionShape Mezzanine::ActorSoftCollisionShape Mezzanine::DynamicMeshCollisionShape Mezzanine::StaticMeshCollisionShape Mezzanine::BoxCollisionShape Mezzanine::CapsuleCollisionShape Mezzanine::ConeCollisionShape Mezzanine::ConvexHullCollisionShape Mezzanine::CylinderCollisionShape Mezzanine::MultiSphereCollisionShape Mezzanine::SphereCollisionShape

List of all members.

Public Types

enum  ShapeType {
  ST_Box = 0, ST_Capsule = 1, ST_Compound = 2, ST_Cone = 3,
  ST_ConvexHull = 4, ST_Cylinder = 5, ST_MultiSphere = 6, ST_Sphere = 7,
  ST_DynamicTriMesh = 8, ST_Heightfield = 9, ST_Plane = 10, ST_ActorSoft = 11,
  ST_StaticTriMesh = 12
}
 

This enum describes what kind of shape you are currently working with.

More...

Public Member Functions

 CollisionShape ()
 Class Constructor.
virtual ~CollisionShape ()
 Class Destructor.
virtual btCollisionShape * GetBulletShape () const
 Gets the internal shape pointer this collision shape is based on.
virtual Real GetMargin () const
 Gets the amount of padding currently being applied to the collision shape.
virtual const StringGetName () const
 Gets the name of this shape.
virtual Vector3 GetScaling () const
 Gets the current scaling being applied to the collision shape.
virtual CollisionShape::ShapeType GetType () const =0
 Gets the type of Collision shape this is.
virtual void ProtoDeSerialize (const xml::Node &OneNode)
 Take the data stored in an XML and overwrite this instance of this object with it.
virtual void ProtoSerialize (xml::Node &CurrentRoot) const
 Convert this class to an xml::Node ready for serialization.
virtual void SetMargin (const Real &Margin)
 Sets the padding that will be applied when checking for collisions.
virtual void SetScaling (const Vector3 &Scaling)
 Scales the collision shape on each of it's axes.

Static Public Member Functions

static String SerializableName ()
 Get the name of the the XML tag this class will leave behind as its instances are serialized.

Protected Attributes

String Name
 Storage for the name of this class instance.
btCollisionShape * ShapeBase
 A pointer to the bullet collision this uses.

Friends

class CollisionShapeManager

Detailed Description

This is the base class for all collision shapes.

Currently there are a total of 13 collision shape classes inheriting from 3 other base classes. Collision shapes are shape representations for Actors, AreaEffects, and other classes with bodies in the physics engine.

It's important to note that Collision shapes can be created and then re-used in as many World objects(at the same time) as you need, and it is encouraged to do this.

Definition at line 80 of file collisionshape.h.


Member Enumeration Documentation

This enum describes what kind of shape you are currently working with.

Note:
These are number primarily for Serialization purposes. These corresponding numbers could vary wildly. Any use of corresponding raw number in serialization will be done with object serialization version in mind.
Enumerator:
ST_Box 

Indicates the class is a BoxCollisionShape.

ST_Capsule 

Indicates the class is a CapsuleCollisionShape.

ST_Compound 

Indicates the class is a CompoundCollisionShape.

ST_Cone 

Indicates the class is a ConeCollisionShape.

ST_ConvexHull 

Indicates the class is a ConvexHullCollisionShape.

ST_Cylinder 

Indicates the class is a CylinderCollisionShape.

ST_MultiSphere 

Indicates the class is a MultiSphereCollisionShape.

ST_Sphere 

Indicates the class is a SphereCollisionShape.

ST_DynamicTriMesh 

Indicates the class is a DynamicMeshCollisionShape.

ST_Heightfield 

Indicates the class is a HeightfieldCollisionShape.

ST_Plane 

Indicates the class is a PlaneCollisionShape.

ST_ActorSoft 

Indicates the class is a ActorSoftCollisionShape.

ST_StaticTriMesh 

Indicates the class is a StaticMeshCollisionShape.

Definition at line 86 of file collisionshape.h.


Member Function Documentation

btCollisionShape * Mezzanine::CollisionShape::GetBulletShape ( ) const [virtual]

Gets the internal shape pointer this collision shape is based on.

Returns:
Returns a pointer to the internal collision shape.

Definition at line 93 of file collisionshape.cpp.

Real Mezzanine::CollisionShape::GetMargin ( ) const [virtual]

Gets the amount of padding currently being applied to the collision shape.

Returns:
Returns the amount of padding, in world units, is being applied to the collision shape.

Definition at line 78 of file collisionshape.cpp.

const String & Mezzanine::CollisionShape::GetName ( ) const [virtual]

Gets the name of this shape.

Returns:
Returns a const reference string containing the name of this collision shape.

Definition at line 68 of file collisionshape.cpp.

Vector3 Mezzanine::CollisionShape::GetScaling ( ) const [virtual]

Gets the current scaling being applied to the collision shape.

Returns:
Returns a vector3 representing the amount of scaling being applied to the shape.

Definition at line 88 of file collisionshape.cpp.

void Mezzanine::CollisionShape::ProtoDeSerialize ( const xml::Node OneNode) [virtual]

Take the data stored in an XML and overwrite this instance of this object with it.

Parameters:
OneNodeand xml::Node containing the data.
Warning:
A precondition of using this is that all of the actors intended for use must already be Deserialized.

Reimplemented in Mezzanine::PrimitiveCollisionShape, Mezzanine::FieldCollisionShape, Mezzanine::MeshCollisionShape, Mezzanine::CompoundCollisionShape, Mezzanine::BoxCollisionShape, Mezzanine::CapsuleCollisionShape, Mezzanine::ConeCollisionShape, Mezzanine::ConvexHullCollisionShape, Mezzanine::CylinderCollisionShape, Mezzanine::MultiSphereCollisionShape, and Mezzanine::SphereCollisionShape.

Definition at line 125 of file collisionshape.cpp.

void Mezzanine::CollisionShape::ProtoSerialize ( xml::Node CurrentRoot) const [virtual]
String Mezzanine::CollisionShape::SerializableName ( ) [static]
void Mezzanine::CollisionShape::SetMargin ( const Real Margin) [virtual]

Sets the padding that will be applied when checking for collisions.

Parameters:
MarginA real in world units representing how much padding is to be applied to this shape.

Definition at line 73 of file collisionshape.cpp.

void Mezzanine::CollisionShape::SetScaling ( const Vector3 Scaling) [virtual]

Scales the collision shape on each of it's axes.

Parameters:
ScalingA vector3 representing how much scaling should be applied on each of the shapes 3 axes.

Definition at line 83 of file collisionshape.cpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines