Convenience routines for creating Bullet rigid bodies from scene graphs. More...
Functions | |
| OSGBDYNAMICS_EXPORT btRigidBody * | osgbDynamics::createRigidBody (osgbDynamics::CreationRecord *cr) |
| Creates a compound collision shape and rigid body from the CreationRecord data. | |
| OSGBDYNAMICS_EXPORT btRigidBody * | osgbDynamics::createRigidBody (osgbDynamics::CreationRecord *cr, btCollisionShape *shape) |
Convenience routines for creating Bullet rigid bodies from scene graphs.
These functions use the CreationRecord struct to create collision shapes, rigid bodies, and motion state objects. The application is responsible for setting the CreationRecord fields as needed. The fields are used as follows:
_sceneGraph Geometric source data for collision shape and rigid body creation. _comSet is false, the _sceneGraph bounding sphere center is used as the center of mass. _sceneGraph is a Transform node, it is set as the managed Transform node in MotionState (MotionState::setTransform()). _com When _comSet is true, _com is the center of mass. Otherwise, the bounding volume center is used as the center of mass. (See CreationRecord::setCenterOfMass().) _scale vector is used as a transform for geometric data during collision shape creation. _scale xyz scale vector. (osgBullet supports non-uniform scaling.) _scale vector is used as a transform for geometric data during collision shape creation. _scale is passed to the created MotionState object (MotionState::setScale()). _parentTransform Used to specify an initial position. It is set as the MotionState parent transform (MotionState::setParentTransform()). _shapeType Passed to osgbCollision::btCompoundShapeFromOSGGeodes(). _mass _restitution Set in the created rigid body via btRigidBody::btRigidBodyConstructionInfo::m_restitution. _friction Set in the created rigid body via btRigidBody::btRigidBodyConstructionInfo::m_friction. _axis Passed to osgbCollision::btCompoundShapeFromOSGGeodes(). Ultimately, it is referenced only if _shapeType is CYLINDER_SHAPE_PROXYTYPE. _reductionLevel Passed to osgbCollision::btCompoundShapeFromOSGGeodes(). If _shapeType is TRIANGLE_MESH_SHAPE_PROXYTYPE or CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE, this value is used to configure osgWorks geometry reduction utilities to reduce triangle count prior to creating the collision shape. Note that these are merely convenience routines, and your application can interface directly with Bullet to create collision shapes and rigid bodies. However, you should strongly consider using these convenience routines for the following reasons:
Requirements
Functionality Removed in v2.0
| btRigidBody * osgbDynamics::createRigidBody | ( | osgbDynamics::CreationRecord * | cr ) |
Creates a compound collision shape and rigid body from the CreationRecord data.
Uses the osgbCollision::ComputeShapeVisitor to create a btCompoundShape from CreationRecord::_sceneGraph. Currently, a shape per Geode is created. CreationRecord::_shapeType specifies the shape type created per Geode. If CreationRecord::_shapeType is CYLINDER_SHAPE_PROXYTYPE, CreationRecord::_axis specifies the cylinder major axis.
| btRigidBody * osgbDynamics::createRigidBody | ( | osgbDynamics::CreationRecord * | cr, |
| btCollisionShape * | shape | ||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Use this function to create a rigid body if you have already created the collision shape. This is useful for sharing collision shapes.
1.7.2