GCOP  1.0
Public Member Functions | Public Attributes | Protected Attributes
gcop::BulletWorld Class Reference

#include <bulletworld.h>

List of all members.

Public Member Functions

 BulletWorld (bool usezupaxis_=false, btVector3 worldMin_=btVector3(-1000,-1000,-1000), btVector3 worldMax_=btVector3(1000, 1000, 1000))
bool IsZupAxis ()
void SetGravity (btVector3 gravity_)
btRigidBody * LocalCreateRigidBody (float mass, const btTransform &startTransform, btCollisionShape *shape, bool use_motion_state=false)
btTriangleIndexVertexArray * CreateVertexArrayFromSTL (const char *filename, btVector3 scale=btVector3(1, 1, 1))
btCollisionShape * CreateMeshFromData (btScalar *verts, int *inds, int noftriangles, int nofverts)
btCollisionShape * CreateMeshFromSTL (const char *filename, btVector3 scale=btVector3(1, 1, 1))
btCollisionShape * CreateHeightMap (btScalar length, btScalar width, const char *data, btScalar maxHeight=100)
btCollisionShape * CreateGroundPlane (btScalar length, btScalar width, btScalar(*heightfunc)(btScalar, btScalar)=0, int subdivisions=1)
void Step (double dt, int substeps)
void Reset ()
 ~BulletWorld ()

Public Attributes

btDynamicsWorld * m_dynamicsWorld
 this is the most important class It represents the Discrete Dynamics World
btScalar m_defaultContactProcessingThreshold
 Collisions between objects are not processed until this threshold. Avoids jittering behaviour.
btAlignedObjectArray
< btCollisionShape * > 
m_collisionShapes
 Stores all the collision shapes in a world for drawing and cleaning.
btVector3 worldMin
 Minimum and maximum for world.
btVector3 worldMax

Protected Attributes

class btBroadphaseInterface * m_overlappingPairCache
 Broadphase collision checker.
class btCollisionDispatcher * m_dispatcher
 Collision checker.
class btConstraintSolver * m_constraintSolver
 Constraint Solver.
class
btDefaultCollisionConfiguration * 
m_collisionConfiguration
 Default Collision configuration used from bullet demos.
bool usezupaxis
 Used to define the coordinate system for world. Two options available (z up y forward x right OR y up z forward x to left)

Constructor & Destructor Documentation

gcop::BulletWorld::BulletWorld ( bool  usezupaxis_ = false,
btVector3  worldMin_ = btVector3(-1000,-1000,-1000),
btVector3  worldMax_ = btVector3(1000,1000,1000) 
) [inline]

Constructor. Gravity is always acting downwards (9.81) in whatever coordinate system

Parameters:
usezupaxis_Set the coordinate system
worldMin_Bound on the world dimensions
worldMax_Bound on the world dimensions

Destructor for Bullet Physics Engine cleansup all the objects created by various functions above


Member Function Documentation

btCollisionShape* gcop::BulletWorld::CreateGroundPlane ( btScalar  length,
btScalar  width,
btScalar(*)(btScalar, btScalar)  heightfunc = 0,
int  subdivisions = 1 
) [inline]

Create a ground plane with custom height function if provided. This can also be used to create custom 3D terrains with known height at each grid point

Parameters:
lengthlength of the plane
widthwidth of the plane
heightfuncHeight function which provides height given the grid coordinates. The origin of the plane for height function is situated at the left end of the plane(x: 0->length; y:0->width);
subdivisionsNumber of divisions of the grid for plane. The finer the grid the more the mesh represents the true height function
btCollisionShape* gcop::BulletWorld::CreateHeightMap ( btScalar  length,
btScalar  width,
const char *  data,
btScalar  maxHeight = 100 
) [inline]

Creates a DEM Height map from height data. The local origin is at the center of the image with height = average of the max and min heights. Here minheight is 0m

Parameters:
lengthlength of the image grid
widhthwidth of the image grid
dataImage intensities unsigned 8 bit should be valid throughout the life time of the collision shape
maxHeightUses the maximum height in meters to scale the image intensities accordingly
btCollisionShape* gcop::BulletWorld::CreateMeshFromData ( btScalar *  verts,
int *  inds,
int  noftriangles,
int  nofverts 
) [inline]

Creates a triangular mesh from vertex data. The number of indices should be equal to 3 times the number of triangles The vertex data can be smaller than 3*noftriangles since different triangles can share vertices By default assumes each index corresponds to a vertex

Parameters:
vertspointer to vertices
indsindices of the verts which form a triangle
nofvertsNumber of vertices sent by the pointer verts
btCollisionShape* gcop::BulletWorld::CreateMeshFromSTL ( const char *  filename,
btVector3  scale = btVector3(1,1,1) 
) [inline]

Loads a mesh from Binary STL Files. Modified from LoadMeshFromSTL used by Bullet3 Demo

Parameters:
filenameStl File name.
scaleMultiplies all the vertices with the scale thereby scaling the mesh
btTriangleIndexVertexArray* gcop::BulletWorld::CreateVertexArrayFromSTL ( const char *  filename,
btVector3  scale = btVector3(1,1,1) 
) [inline]

Loads a mesh from Binary STL Files. Modified from LoadMeshFromSTL used by Bullet3 Demo

Parameters:
filenameStl File name.
scaleMultiplies all the vertices with the scale thereby scaling the mesh
Returns:
Returns a vertex array which can be used to modify the STL file later
bool gcop::BulletWorld::IsZupAxis ( ) [inline]
btRigidBody* gcop::BulletWorld::LocalCreateRigidBody ( float  mass,
const btTransform &  startTransform,
btCollisionShape *  shape,
bool  use_motion_state = false 
) [inline]

Create a rigidbody in the world file

Parameters:
massMass of the rigidbody. Static objects have 0 mass
startTransformInitial transform of the rigidbody
shapeEach rigid body has a shape of its own which can be a mesh/cube/combination of different shapes etc
use_motion_stateUsing a motion state allows bullet to interpolate between transforms when polling for rigidbody transformation for display or computation

Referenced by gcop::Bulletrccar::Bulletrccar(), gcop::Bulletrccar1::Bulletrccar1(), and gcop::Bulletrccar::Reset().

void gcop::BulletWorld::Reset ( ) [inline]

Reset Bullet Physics Engine and clear collision info and reset constraint solver

Referenced by gcop::Bulletrccar1::reset(), and gcop::Bulletrccar::Reset().

void gcop::BulletWorld::SetGravity ( btVector3  gravity_) [inline]

Set the gravity vector in the world

Parameters:
gravity_gravity vector to be set
void gcop::BulletWorld::Step ( double  dt,
int  substeps 
) [inline]

Simulates the world along with all the physical objects in it. No interpolation is used for simulation.

Parameters:
dtTime in seconds to simulate for
substepsNumber of steps the time should be broken into for physics engine.

Member Data Documentation

class btDefaultCollisionConfiguration* gcop::BulletWorld::m_collisionConfiguration [protected]

Default Collision configuration used from bullet demos.

btAlignedObjectArray<btCollisionShape*> gcop::BulletWorld::m_collisionShapes

Stores all the collision shapes in a world for drawing and cleaning.

Referenced by gcop::Bulletrccar1::Bulletrccar1().

class btConstraintSolver* gcop::BulletWorld::m_constraintSolver [protected]

Constraint Solver.

Collisions between objects are not processed until this threshold. Avoids jittering behaviour.

class btCollisionDispatcher* gcop::BulletWorld::m_dispatcher [protected]

Collision checker.

class btBroadphaseInterface* gcop::BulletWorld::m_overlappingPairCache [protected]

Broadphase collision checker.

Used to define the coordinate system for world. Two options available (z up y forward x right OR y up z forward x to left)

Minimum and maximum for world.


The documentation for this class was generated from the following file: