Physics‎ > ‎Physics API‎ > ‎Bullet‎ > ‎

Constraint


Constraints are added with btDynamicsWorld::addConstraint and removed with btDynamicsWorld::removeConstraint. btTypedConstraint is the base for all the constraints.

btFixedConstraint

btPoint2PointConstraint
Link two rigidbodies so the pivot points match in worldspace. Can be used to make a chain. It is possible to specify limits for how much it can rotate and a motor to make it turn.

btHingeConstraint
Create a door or a wheel.

Use enableAngularMotor to spin wheel.

btHinge2Constraint
This is used to create a wheel with a spring that one can steer. One give a anchor point and axis1 and axis2. All of them are in world space so the wheel and car body need to be in the correct place already.

Anchor: Is the center position of the weel.
Axis1: The suspension spring axis that will also be used to steer the wheel.
Axis2: Axis that the wheel spins around when it's rolling.

Use setLowerLimit and setUpperLimit to set the angles the wheel can steer in.
Use getRotationalLimitMotor(2) to get motor to turn with. Set m_enableMotor, m_maxMotorForce and m_targetVelocity.



Comments