![]() |
![]() |
![]() |
Clutter-Box2D 0.10.0 Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
ClutterBox2DJoint; void clutter_box2d_joint_destroy (ClutterBox2DJoint *joint); ClutterBox2DJoint * clutter_box2d_add_revolute_joint (ClutterBox2D *box2d, ClutterActor *actor1, ClutterActor *actor2, const ClutterVertex *anchor1, const ClutterVertex *anchor2, gdouble reference_angle); ClutterBox2DJoint * clutter_box2d_add_revolute_joint2 (ClutterBox2D *box2d, ClutterActor *actor1, ClutterActor *actor2, const ClutterVertex *anchor); ClutterBox2DJoint * clutter_box2d_add_distance_joint (ClutterBox2D *box2d, ClutterActor *actor1, ClutterActor *actor2, const ClutterVertex *anchor1, const ClutterVertex *anchor2, gdouble length, gdouble frequency, gdouble damping_ratio); ClutterBox2DJoint * clutter_box2d_add_prismatic_joint (ClutterBox2D *box2d, ClutterActor *actor1, ClutterActor *actor2, const ClutterVertex *anchor1, const ClutterVertex *anchor2, gdouble min_length, gdouble max_length, const ClutterVertex *axis); ClutterBox2DJoint * clutter_box2d_add_mouse_joint (ClutterBox2D *box2d, ClutterActor *actor, const ClutterVertex *target); void clutter_box2d_mouse_joint_update_target (ClutterBox2DJoint *mouse_joint, const ClutterVertex *target);
Joints connects actors. Joints can be manually destroyed, if they are not manually destroyed they are destroyed when one of the member actors of the joint is destroyed.
typedef struct _ClutterBox2DJoint ClutterBox2DJoint;
A handle refering to a joint in a ClutterBox2D container, joints are automatically memory managed by Box2D and get destroyed if any of the actors invovled in the joint is destroyed. You may also explicitly free the joint by calling clutter_box2d_joint_destroy on a joint that is no longer needed.
void clutter_box2d_joint_destroy (ClutterBox2DJoint *joint);
Destroys a ClutterBox2DJoint, call this function manually to remove a joint that you no longer have need for. Note that it is mostly not neccesary to destroy joints that are part of models manually since they will be destroyed automatically when the actors they use are destroyed.
|
A ClutterBox2DJoint |
ClutterBox2DJoint * clutter_box2d_add_revolute_joint (ClutterBox2D *box2d, ClutterActor *actor1, ClutterActor *actor2, const ClutterVertex *anchor1, const ClutterVertex *anchor2, gdouble reference_angle);
Create a revolute joint. A revolute joint defines a coordinates on two actors that should coincide. The actors are allowed to rotate around this point making it act like an axle.
|
a ClutterBox2D |
|
first actor participating in joint |
|
second actor participating in joint |
|
the local coordinates for the common point on actor1
|
|
the local coordinates fro the common point on actor2
|
|
the initial relative angle for joint limit (currently unused) |
Returns : |
a ClutterBox2DJoint handle or NULL on error. |
ClutterBox2DJoint * clutter_box2d_add_revolute_joint2 (ClutterBox2D *box2d, ClutterActor *actor1, ClutterActor *actor2, const ClutterVertex *anchor);
Create a revolute joint that is defined by original positions of actors and a common point specified in world coordinates.
|
a ClutterBox2D |
|
first actor participating in joint |
|
second actor participating in joint |
|
the world (box2d container) coordinates for the point that actor1
and actor2 are allowed to revolve around.
|
Returns : |
a ClutterBox2DJoint handle or NULL on error. |
ClutterBox2DJoint * clutter_box2d_add_distance_joint (ClutterBox2D *box2d, ClutterActor *actor1, ClutterActor *actor2, const ClutterVertex *anchor1, const ClutterVertex *anchor2, gdouble length, gdouble frequency, gdouble damping_ratio);
A distance joint constrains two points on two bodies to remain at a fixed
distance from each other. You can view this as a massless, rigid rod. By
modifying frequency
and damping_ratio
you can achieve a spring like
behavior as well. The defaults for frequency and damping_ratio to disable
dampening is 0.0 for both.
|
a ClutterBox2D |
|
first actor participating in joint |
|
second actor participating in joint |
|
the local coordinates for the common point on actor1
|
|
the local coordinates fro the common point on actor2
|
|
the length that the simulation will maintain between anchor1 on actor1 and anchor2 on actor2. |
|
the frequency of length updates. |
|
the damping ratio. |
Returns : |
a ClutterBox2DJoint handle or NULL on error. |
ClutterBox2DJoint * clutter_box2d_add_prismatic_joint (ClutterBox2D *box2d, ClutterActor *actor1, ClutterActor *actor2, const ClutterVertex *anchor1, const ClutterVertex *anchor2, gdouble min_length, gdouble max_length, const ClutterVertex *axis);
A prismatic joint. This joint provides one degree of freedom: translation along an axis fixed in body1. Relative rotation is prevented.
|
a ClutterBox2D |
|
first actor participating in joint |
|
second actor participating in joint |
|
the local coordinates for the common point on actor1
|
|
the local coordinates fro the common point on actor2
|
|
minimum distance between anchor points |
|
maximum distance between anchor points. |
|
the local translation axis in body1 .
|
Returns : |
a ClutterBox2DJoint handle or NULL on error. |
ClutterBox2DJoint * clutter_box2d_add_mouse_joint (ClutterBox2D *box2d, ClutterActor *actor, const ClutterVertex *target);
A mouse joint is used to make a point on a dynamic actor track a specified world point. This a soft constraint with a maximum force. This allows the constraint to stretch and without applying huge forces.
|
a ClutterBox2D |
|
the (dynamic) actor to be manipulated. |
|
the box2d container coordinates of the mouse. |
Returns : |
a ClutterBox2DJoint handle or NULL on error. |
void clutter_box2d_mouse_joint_update_target (ClutterBox2DJoint *mouse_joint, const ClutterVertex *target);
Updates the position the the target point should coincide with. By updating this in a motion event callback for mouse motion physical interaction with dynamic actors is possible.
|
A ClutterBox2DJoint priorly returned from clutter_box2d_add_mouse_joint. |
|
new box2d container coordinates for mouse pointer. |