GCOP
1.0
|
#include <bulletworld.h>
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) |
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
usezupaxis_ | Set the coordinate system |
worldMin_ | Bound on the world dimensions |
worldMax_ | Bound on the world dimensions |
gcop::BulletWorld::~BulletWorld | ( | ) | [inline] |
Destructor for Bullet Physics Engine cleansup all the objects created by various functions above
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
length | length of the plane |
width | width of the plane |
heightfunc | Height 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); |
subdivisions | Number 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
length | length of the image grid |
widhth | width of the image grid |
data | Image intensities unsigned 8 bit should be valid throughout the life time of the collision shape |
maxHeight | Uses 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
verts | pointer to vertices |
inds | indices of the verts which form a triangle |
nofverts | Number 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
filename | Stl File name. |
scale | Multiplies 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
filename | Stl File name. |
scale | Multiplies all the vertices with the scale thereby scaling the mesh |
bool gcop::BulletWorld::IsZupAxis | ( | ) | [inline] |
Returns the type of coordinate system used
Referenced by gcop::Bulletrccar::Bulletrccar(), gcop::Bulletrccar1::Bulletrccar1(), gcop::Bulletrccar1::reset(), gcop::Bulletrccar::Reset(), gcop::Bulletrccar::setinitialstate(), gcop::Bulletrccar::Step(), and gcop::Bulletrccar1::Step1().
btRigidBody* gcop::BulletWorld::LocalCreateRigidBody | ( | float | mass, |
const btTransform & | startTransform, | ||
btCollisionShape * | shape, | ||
bool | use_motion_state = false |
||
) | [inline] |
Create a rigidbody in the world file
mass | Mass of the rigidbody. Static objects have 0 mass |
startTransform | Initial transform of the rigidbody |
shape | Each rigid body has a shape of its own which can be a mesh/cube/combination of different shapes etc |
use_motion_state | Using 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
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.
dt | Time in seconds to simulate for |
substeps | Number of steps the time should be broken into for physics engine. |
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.
btDynamicsWorld* gcop::BulletWorld::m_dynamicsWorld |
this is the most important class It represents the Discrete Dynamics World
Referenced by gcop::Bulletrccar::Bulletrccar(), gcop::Bulletrccar1::Bulletrccar1(), gcop::Bulletrccar1::reset(), gcop::Bulletrccar::Reset(), gcop::Bulletrccar::setinitialstate(), gcop::Bulletrccar::Step(), and gcop::Bulletrccar1::Step1().
class btBroadphaseInterface* gcop::BulletWorld::m_overlappingPairCache [protected] |
Broadphase collision checker.
bool gcop::BulletWorld::usezupaxis [protected] |
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)
btVector3 gcop::BulletWorld::worldMax |
btVector3 gcop::BulletWorld::worldMin |
Minimum and maximum for world.