Magnum::BulletIntegration::MotionState class

Bullet Physics motion state.

Encapsulates btMotionState as a SceneGraph feature.

Usage

Common usage is to either create a btRigidBody to share transformation with a SceneGraph::Object by passing the motion state in its constructor:

SceneGraph::Object<SceneGraph::MatrixTransformation3D> object;
btRigidBody rigidBody{mass, &(new MotionState{object}).btMotionState(), collisionShape};

// rigidBody will be affected when changing the transform of object and
// object will be affected when transformation of rigidBody is changed.

Or setting the motion state afterwards:

SceneGraph::Object<SceneGraph::MatrixTransformation3D> object;
btRigidBody rigidBody{...};
rigidBody.setMotionState(&(new MotionState{object}).btMotionState());

Note that changes to a rigidBody using btRigidBody::setWorldTransform() may only update the motion state of non-static objects and while btDynamicsWorld::stepSimulation() is called.

Base classes

template<UnsignedInt dimensions, class T>
class Magnum::SceneGraph::AbstractFeature
Base for object features.

Constructors, destructors, conversion operators

template<class T>
MotionState(T& object)
Constructor.

Public functions

auto btMotionState() -> btMotionState&
Motion state.

Function documentation

template<class T>
Magnum::BulletIntegration::MotionState::MotionState(T& object)

Constructor.

Parameters
object Object this motion state belongs to