Distance joint
ep_distancejoint_create
ep_distancejoint_create(world_id, body1_id, body2_id, x1, y1, x2, y2)
Creates a new distance joint.
Returns the id of the new distance 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.
ep_distancejoint_destroy
ep_distancejoint_destroy(world_id, distancejoint_id)
Destroys the distance joint
-
world_id: The id of the world.
-
distancejoint_id: The id of the distance joint.
ep_distancejoint_exists
ep_distancejoint_exists(world_id, distancejoint_id)
Returns whether the distance joint with the given id exists.
-
world_id: The id of the world.
-
distancejoint_id: The id of the distance joint.
ep_distancejoint_set_motor
ep_distancejoint_set_motor(world_id, distancejoint_id, maxmotorforce, motorvel)
Changes the motor of the distance joint.
-
world_id: The id of the world.
-
distancejoint_id: The id of the distance joint.
-
maxmotorforce: The maximum motor force.
-
motorvel: The velocity of the motor.
ep_distancejoint_set_limit_settings
ep_distancejoint_set_limit_settings(world_id, distancejoint_id, contact_threshold, velocity_threshold)
Changes the limit settings of the distance joint.
-
contact_threshold: The contact threshold.
-
velocity_threshold: The velocity threshold.
ep_distancejoint_set_lower_limit
ep_distancejoint_set_lower_limit(world_id, distancejoint_id, maxlimitforce, distance, restitution, velocity)
Changes the lower limit of the distance joint.
-
world_id: The id of the world.
-
distancejoint_id: The id of the distance joint.
-
maxlimitforce: The maximum limit force. Set this to 0 to disable the limit.
-
distance: The distance of the limit.
-
restitution: The coefficient of restitution.
-
velocity: The velocity of the limit. You can use this to change the distance over time. The distance will not be updated automatically, you have to do that yourself.
ep_distancejoint_set_upper_limit
ep_distancejoint_set_upper_limit(world_id, distancejoint_id, maxlimitforce, distance, restitution, velocity)
Changes the upper limit of the distance joint.
-
world_id: The id of the world.
-
distancejoint_id: The id of the distance joint.
-
maxlimitforce: The maximum limit force. Set this to 0 to disable the limit.
-
distance: The distance of the limit.
-
restitution: The coefficient of restitution.
-
velocity: The velocity of the limit. You can use this to change the distance over time. The distance will not be updated automatically, you have to do that yourself.
ep_distancejoint_set_lower_spring
ep_distancejoint_set_lower_spring(world_id, distancejoint_id, k, distance, damping)
Changes the lower spring of the distance joint.
-
world_id: The id of the world.
-
distancejoint_id: The id of the distance joint.
-
k: The spring constant. Set this to 0 to disable the spring.
-
distance: The distance of the spring.
-
damping: The damping force of the spring. Set this to 0 to disable damping (not recommended).
ep_distancejoint_set_upper_spring
ep_distancejoint_set_upper_spring(world_id, distancejoint_id, k, distance, damping)
Changes the upper spring of the distance joint.
-
world_id: The id of the world.
-
distancejoint_id: The id of the distance joint.
-
k: The spring constant. Set this to 0 to disable the spring.
-
distance: The distance of the spring.
-
damping: The damping force of the spring. Set this to 0 to disable damping (not recommended).
ep_distancejoint_get_body1
ep_distancejoint_get_body1(world_id, distancejoint_id)
Returns the id of the first body connected to the distance joint.
-
world_id: The id of the world.
-
distancejoint_id: The id of the distance joint.
ep_distancejoint_get_body2
ep_distancejoint_get_body2(world_id, distancejoint_id)
Returns the id of the second body connected to the distance joint.
-
world_id: The id of the world.
-
distancejoint_id: The id of the distance joint.
ep_distancejoint_get_distance
ep_distancejoint_get_distance(world_id, distancejoint_id)
Returns the current distance between the anchor points of the distance joint.
-
world_id: The id of the world.
-
distancejoint_id: The id of the distance joint.
ep_distancejoint_get_motor_force
ep_distancejoint_get_motor_force(world_id, distancejoint_id)
Returns the motor force applied during the last step.
-
world_id: The id of the world.
-
distancejoint_id: The id of the distance joint.
ep_distancejoint_get_limit_force
ep_distancejoint_get_limit_force(world_id, distancejoint_id)
Returns the limit force applied during the last step.
-
world_id: The id of the world.
-
distancejoint_id: The id of the distance joint.
ep_distancejoint_previous
ep_distancejoint_previous(world_id, distancejoint_id)
Returns the id of the previous distance joint, or 0 if there is no previous distance joint.
-
world_id: The id of the world.
-
distancejoint_id: The id of the distance joint.
ep_distancejoint_next
ep_distancejoint_next(world_id, distancejoint_id)
Returns the id of the next distance joint, or 0 if there is no next distance joint.
-
world_id: The id of the world.
-
distancejoint_id: The id of the distance joint.
ep_distancejoint_set_uservar
ep_distancejoint_set_uservar(world_id, distancejoint_id, index, value)
Changes the value of the user variable with the given index.
-
world_id: The id of the world.
-
distancejoint_id: The id of the distance joint.
-
index: The index (0-4).
-
value: The new value.
ep_distancejoint_get_uservar
ep_distancejoint_get_uservar(world_id, distancejoint_id, index)
Returns the value of the user variable with the given index.
-
world_id: The id of the world.
-
distancejoint_id: The id of the distance joint.
-
index: The index (0-4).
Comments
Plmqaz1243 |
Comment #1: Wed, 29 Jun 2016, 20:14 (GMT+1, DST) Hi, I'm wondering if there's any way to draw distance joints without using debugdraw(). More specifically, if there's a way to retrieve the x and y coordinates of a distancejoint on a body. I could probably save all of these to an array (or a DS map would probably work better) but is there any built in function that can do this? |