Hinge joint
Last updated 12 August 2014
ep_hingejoint_create
ep_hingejoint_create(world_id, body1_id, body2_id, x1, y1, x2, y2, referencerotation)
Creates a new hinge joint.
Returns the id of the new hinge joint.
- world_id: The id of the world.
- body1_id: The id of the first body.
- body2_id: The id of the second body.
- x1: The x component of the anchor point on the first body.
- y1: The y component of the anchor point on the first body.
- x2: The x component of the anchor point on the second body.
- y2: The y component of the anchor point on the second body.
- referencerotation: The reference angle used to calculate the relative rotation of the bodies (rot1-rot2). This is only relevant if you use ep_hingejoint_get_rotation, springs or limits.
ep_hingejoint_destroy
ep_hingejoint_destroy(world_id, hingejoint_id)
Destroys the hinge joint.
- world_id: The id of the world.
- hingejoint_id: The id of the hinge joint.
ep_hingejoint_exists
ep_hingejoint_exists(world_id, hingejoint_id)
Returns whether the hinge joint with the given id exists.
- world_id: The id of the world.
- hingejoint_id: The id of the hinge joint.
ep_hingejoint_set_max_force
ep_hingejoint_set_max_force(world_id, hingejoint_id, maxforce)
Changes the maximum force of the hinge joint.
- world_id: The id of the world.
- hingejoint_id: The id of the hinge joint.
- maxforce: The new maximum force. Use 0 for no limit.
ep_hingejoint_set_motor
ep_hingejoint_set_motor(world_id, hingejoint_id, maxmotortorque, motorvel)
Changes the motor of the hinge joint.
- world_id: The id of the world.
- hingejoint_id: The id of the hinge joint.
- maxmotortorque: The maximum motor torque. Set this to 0 to disable the motor.
- motorvel: The velocity of the motor.
ep_hingejoint_set_limit_settings
ep_hingejoint_set_limit_settings(world_id, hingejoint_id, contact_threshold, velocity_threshold)
Changes the limit settings of the hinge joint.
- world_id: The id of the world.
- hingejoint_id: The id of the hinge joint.
- contact_threshold: The contact threshold.
- velocity_threshold: The velocity threshold.
ep_hingejoint_set_lower_limit
ep_hingejoint_set_lower_limit(world_id, hingejoint_id, maxlimittorque, rotation, restitution, velocity)
Changes the lower limit of the hinge joint.
- world_id: The id of the world.
- hingejoint_id: The id of the hinge joint.
- maxlimittorque: The maximum limit torque. Set this to 0 to disable the limit.
- rotation: The rotation of the limit.
- restitution: The coefficient of restitution.
- velocity: The velocity of the limit. You can use this to change the rotation over time. The rotation will not be updated automatically, you have to do that yourself.
ep_hingejoint_set_upper_limit
ep_hingejoint_set_upper_limit(world_id, hingejoint_id, maxlimittorque, rotation, restitution, velocity)
Changes the upper limit of the hinge joint.
- world_id: The id of the world.
- hingejoint_id: The id of the hinge joint.
- maxlimittorque: The maximum limit torque. Set this to 0 to disable the limit.
- rotation: The rotation of the limit.
- restitution: The coefficient of restitution.
- velocity: The velocity of the limit. You can use this to change the rotation over time. The rotation will not be updated automatically, you have to do that yourself.
ep_hingejoint_set_lower_spring
ep_hingejoint_set_lower_spring(world_id, hingejoint_id, k, rotation, damping)
Sets the lower spring of the hinge joint.
- world_id: The id of the world.
- hingejoint_id: The id of the hinge joint.
- k: The spring constant. Set this to 0 to disable the spring.
- rotation: The rotation of the spring.
- damping: The damping force of the spring. Set this to 0 to disable damping (not recommended).
ep_hingejoint_set_upper_spring
ep_hingejoint_set_upper_spring(world_id, hingejoint_id, k, rotation, damping)
Sets the upper spring of the hinge joint.
- world_id: The id of the world.
- hingejoint_id: The id of the hinge joint.
- k: The spring constant. Set this to 0 to disable the spring.
- rotation: The rotation of the spring.
- damping: The damping force of the spring. Set this to 0 to disable damping (not recommended).
ep_hingejoint_get_body1
ep_hingejoint_get_body1(world_id, hingejoint_id)
Returns the id of the first body connected to the hinge joint.
- world_id: The id of the world.
- hingejoint_id: The id of the hinge joint.
ep_hingejoint_get_body2
ep_hingejoint_get_body2(world_id, hingejoint_id)
Returns the id of the second body connected to the hinge joint.
- world_id: The id of the world.
- hingejoint_id: The id of the hinge joint.
ep_hingejoint_get_rotation
ep_hingejoint_get_rotation(world_id, hingejoint_id)
Returns the current rotation of the hinge joint (body1.rot-body2.rot-referencerotation).
- world_id: The id of the world.
- hingejoint_id: The id of the hinge joint.
ep_hingejoint_get_xforce
ep_hingejoint_get_xforce(world_id, hingejoint_id)
Returns the x component of the force applied during the last step.
- world_id: The id of the world.
- hingejoint_id: The id of the hinge joint.
ep_hingejoint_get_yforce
ep_hingejoint_get_yforce(world_id, hingejoint_id)
Returns the y component of the force applied during the last step.
- world_id: The id of the world.
- hingejoint_id: The id of the hinge joint.
ep_hingejoint_get_motor_torque
ep_hingejoint_get_motor_torque(world_id, hingejoint_id)
Returns the motor torque applied during the last step.
- world_id: The id of the world.
- hingejoint_id: The id of the hinge joint.
ep_hingejoint_get_limit_torque
ep_hingejoint_get_limit_torque(world_id, hingejoint_id)
Returns the limit torque applied during the last step.
- world_id: The id of the world.
- hingejoint_id: The id of the hinge joint.
ep_hingejoint_previous
ep_hingejoint_previous(world_id, hingejoint_id)
Returns the id of the previous hinge joint, or 0 if there is no previous hinge joint.
- world_id: The id of the world.
- hingejoint_id: The id of the hinge joint.
ep_hingejoint_next
ep_hingejoint_next(world_id, hingejoint_id)
Returns the id of the next hinge joint, or 0 if there is no next hinge joint.
- world_id: The id of the world.
- hingejoint_id: The id of the hinge joint.
ep_hingejoint_set_uservar
ep_hingejoint_set_uservar(world_id, hingejoint_id, index, value)
Changes the value of the user variable with the given index.
- world_id: The id of the world.
- hingejoint_id: The id of the hinge joint.
- index: The index (0-4).
- value: The new value.
ep_hingejoint_get_uservar
ep_hingejoint_get_uservar(world_id, hingejoint_id, index)
Returns the value of the user variable with the given index.
- world_id: The id of the world.
- hingejoint_id: The id of the hinge joint.
- index: The index (0-4).