Functions for the mouse joint. More...

Data Structures | |
| struct | b2MouseJointDef |
| A mouse joint is used to make a point on a body track a specified world point. More... | |
Functions | |
| B2_API b2JointId | b2CreateMouseJoint (b2WorldId worldId, const b2MouseJointDef *def) |
| Create a mouse joint. | |
| B2_API void | b2MouseJoint_SetTarget (b2JointId jointId, b2Vec2 target) |
| Set the mouse joint target. | |
| B2_API b2Vec2 | b2MouseJoint_GetTarget (b2JointId jointId) |
| Get the mouse joint target. | |
| B2_API void | b2MouseJoint_SetSpringHertz (b2JointId jointId, float hertz) |
| Set the mouse joint spring stiffness in Hertz. | |
| B2_API float | b2MouseJoint_GetSpringHertz (b2JointId jointId) |
| Get the mouse joint spring stiffness in Hertz. | |
| B2_API void | b2MouseJoint_SetSpringDampingRatio (b2JointId jointId, float dampingRatio) |
| Set the mouse joint spring damping ratio, non-dimensional. | |
| B2_API float | b2MouseJoint_GetSpringDampingRatio (b2JointId jointId) |
| Get the mouse joint damping ratio, non-dimensional. | |
| B2_API void | b2MouseJoint_SetMaxForce (b2JointId jointId, float maxForce) |
| Set the mouse joint maximum force, usually in newtons. | |
| B2_API float | b2MouseJoint_GetMaxForce (b2JointId jointId) |
| Get the mouse joint maximum force, usually in newtons. | |
| b2MouseJointDef | b2DefaultMouseJointDef (void) |
| Use this to initialize your joint definition. | |
Functions for the mouse joint.
The mouse joint is designed for use in the samples application, but you may find it useful in applications where the user moves a rigid body with a cursor.
| struct b2MouseJointDef |
A mouse joint is used to make a point on a body track a specified world point.
This a soft constraint and allows the constraint to stretch without applying huge forces. This also applies rotation constraint heuristic to improve control.

| Data Fields | ||
|---|---|---|
| b2BodyId | bodyIdA | The first attached body. This is assumed to be static. |
| b2BodyId | bodyIdB | The second attached body. |
| bool | collideConnected | Set this flag to true if the attached bodies should collide. |
| float | dampingRatio | Damping ratio, non-dimensional. |
| float | hertz | Stiffness in hertz. |
| int | internalValue | Used internally to detect a valid definition. DO NOT SET. |
| float | maxForce | Maximum force, typically in newtons. |
| b2Vec2 | target | The initial target point in world space. |
| void * | userData | User data pointer. |
| B2_API b2JointId b2CreateMouseJoint | ( | b2WorldId | worldId, |
| const b2MouseJointDef * | def ) |
Create a mouse joint.