Slider joint
ep_sliderjoint_create
ep_sliderjoint_create(world_id, body1_id, body2_id, x1, y1, x2a, y2a, x2b, y2b, rotation)
Creates a new slider joint.
Returns the id of the new slider 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.
-
x2a: The x component of the starting point of the rail on the second body.
-
y2a: The y component of the starting point of the rail on the second body.
-
x2b: The x component of the endpoint of the rail on the second body.
-
y2b: The y component of the endpoint of the rail on the second body.
-
rotation: The relative rotation of the bodies (rot1-rot2).
ep_sliderjoint_destroy
ep_sliderjoint_destroy(world_id, sliderjoint_id)
Destroys the slider joint.
-
world_id: The id of the world.
-
sliderjoint_id: The id of the slider joint.
ep_sliderjoint_exists
ep_sliderjoint_exists(world_id, sliderjoint_id)
Returns whether the slider joint with the given id exists.
-
world_id: The id of the world.
-
sliderjoint_id: The id of the slider joint.
ep_sliderjoint_set_max_combined_force
ep_sliderjoint_set_max_combined_force(world_id, sliderjoint_id, maxnormalforce, torqueradius)
Changes the maximum combined force of the slider joint.
-
world_id: The id of the world.
-
sliderjoint_id: The id of the slider joint.
-
maxnormalforce: The new maximum normal force. Use 0 for no limit.
-
torqueradius: Indicates how the torque relates to the normal force (force = torque/radius). Use 0 for unlimited torque.
ep_sliderjoint_set_motor
ep_sliderjoint_set_motor(world_id, sliderjoint_id, maxmotorforce, motorvel)
Changes the motor of the slider joint.
-
world_id: The id of the world.
-
sliderjoint_id: The id of the slider joint.
-
maxmotorforce: The maximum motor force.
-
motorvel: The velocity of the motor.
ep_sliderjoint_set_limit_settings
ep_sliderjoint_set_limit_settings(world_id, sliderjoint_id, contact_threshold, velocity_threshold)
Changes the limit settings of the slider joint.
-
world_id: The id of the world.
-
sliderjoint_id: The id of the slider joint.
-
contact_threshold: The contact threshold.
-
velocity_threshold: The velocity threshold.
ep_sliderjoint_set_lower_limit
ep_sliderjoint_set_lower_limit(world_id, sliderjoint_id, maxlimitforce, position, restitution, velocity)
Changes the lower limit of the slider joint.
-
world_id: The id of the world.
-
sliderjoint_id: The id of the slider joint.
-
maxlimitforce: The maximum limit force. Set this to 0 to disable the limit.
-
position: The position of the limit.
-
restitution: The coefficient of restitution.
-
velocity: The velocity of the limit. You can use this to change the position over time. The position will not be updated automatically, you have to do that yourself.
ep_sliderjoint_set_upper_limit
ep_sliderjoint_set_upper_limit(world_id, sliderjoint_id, maxlimitforce, position, restitution, velocity)
Changes the upper limit of the slider joint.
-
world_id: The id of the world.
-
sliderjoint_id: The id of the slider joint.
-
maxlimitforce: The maximum limit force. Set this to 0 to disable the limit.
-
position: The position of the limit.
-
restitution: The coefficient of restitution.
-
velocity: The velocity of the limit. You can use this to change the position over time. The position will not be updated automatically, you have to do that yourself.
ep_sliderjoint_set_lower_spring
ep_sliderjoint_set_lower_spring(world_id, sliderjoint_id, k, position, damping)
Changes the lower spring of the slider joint.
-
world_id: The id of the world.
-
sliderjoint_id: The id of the slider joint.
-
k: The spring constant. Set this to 0 to disable the spring.
-
position: The position of the spring.
-
damping: The damping force of the spring. Set this to 0 to disable damping (not recommended).
ep_sliderjoint_set_upper_spring
ep_sliderjoint_set_upper_spring(world_id, sliderjoint_id, k, position, damping)
Changes the upper spring of the slider joint.
-
world_id: The id of the world.
-
sliderjoint_id: The id of the slider joint.
-
k: The spring constant. Set this to 0 to disable the spring.
-
position: The position of the spring.
-
damping: The damping force of the spring. Set this to 0 to disable damping (not recommended).
ep_sliderjoint_get_body1
ep_sliderjoint_get_body1(world_id, sliderjoint_id)
Returns the id of the first body connected to the slider joint.
-
world_id: The id of the world.
-
sliderjoint_id: The id of the slider joint.
ep_sliderjoint_get_body2
ep_sliderjoint_get_body2(world_id, sliderjoint_id)
Returns the id of the second body connected to the slider joint.
-
world_id: The id of the world.
-
sliderjoint_id: The id of the slider joint.
ep_sliderjoint_get_position
ep_sliderjoint_get_position(world_id, sliderjoint_id)
Returns the current position of the slider joint.
-
world_id: The id of the world.
-
sliderjoint_id: The id of the slider joint.
ep_sliderjoint_get_normal_force
ep_sliderjoint_get_normal_force(world_id, sliderjoint_id)
Returns the normal force applied during the last step.
-
world_id: The id of the world.
-
sliderjoint_id: The id of the slider joint.
ep_sliderjoint_get_torque
ep_sliderjoint_get_torque(world_id, sliderjoint_id)
Returns the torque applied during the last step.
-
world_id: The id of the world.
-
sliderjoint_id: The id of the slider joint.
ep_sliderjoint_get_combined_force
ep_sliderjoint_get_combined_force(world_id, sliderjoint_id)
Returns the combined force applied during the last step (abs(normalforce)+abs(torque)/torqueradius).
-
world_id: The id of the world.
-
sliderjoint_id: The id of the slider joint.
ep_sliderjoint_get_motor_force
ep_sliderjoint_get_motor_force(world_id, sliderjoint_id)
Returns the motor force applied during the last step.
-
world_id: The id of the world.
-
sliderjoint_id: The id of the slider joint.
ep_sliderjoint_get_limit_force
ep_sliderjoint_get_limit_force(world_id, sliderjoint_id)
Returns the limit force applied during the last step.
-
world_id: The id of the world.
-
sliderjoint_id: The id of the slider joint.
ep_sliderjoint_previous
ep_sliderjoint_previous(world_id, sliderjoint_id)
Returns the id of the previous slider joint, or 0 if there is no previous slider joint.
-
world_id: The id of the world.
-
sliderjoint_id: The id of the slider joint.
ep_sliderjoint_next
ep_sliderjoint_next(world_id, sliderjoint_id)
Returns the id of the next slider joint, or 0 if there is no next slider joint.
-
world_id: The id of the world.
-
sliderjoint_id: The id of the slider joint.
ep_sliderjoint_set_uservar
ep_sliderjoint_set_uservar(world_id, sliderjoint_id, index, value)
Changes the value of the user variable with the given index.
-
world_id: The id of the world.
-
sliderjoint_id: The id of the slider joint.
-
index: The index (0-4).
-
value: The new value.
ep_sliderjoint_get_uservar
ep_sliderjoint_get_uservar(world_id, sliderjoint_id, index)
Returns the value of the user variable with the given index.
-
world_id: The id of the world.
-
sliderjoint_id: The id of the slider joint.
-
index: The index (0-4).
Comments
Earacher |
Comment #1: Fri, 8 Feb 2013, 18:48 (GMT+1, DST) Hi maarten! when b1 move(jump,rotate..etc),sometimes b2 dislocation. Last modified: Sat, 9 Feb 2013, 5:25 (GMT+1, DST) |
Maarten BaertAdministrator |
Comment #2: Thu, 14 Feb 2013, 2:39 (GMT+1, DST) Quote: Earacher
Hi maarten! when b1 move(jump,rotate..etc),sometimes b2 dislocation. The picture isn't very clear to me, can you post a larger one with debug drawing enabled? |
Earacher |
Comment #3: Thu, 14 Feb 2013, 7:45 (GMT+1, DST) Quote: Maarten Baert
Quote: Earacher
Hi maarten! when b1 move(jump,rotate..etc),sometimes b2 dislocation. The picture isn't very clear to me, can you post a larger one with debug drawing enabled? That's debug drawing - -. |
Maarten BaertAdministrator |
Comment #4: Fri, 15 Feb 2013, 1:06 (GMT+1, DST) Quote: Earacher
That's debug drawing - -. I've just tried, but I really don't know how you made that happen. The debug drawing indicates that in your last image, the anchor point on the circle is placed wrong. Otherwise the orange dot would have been in the center of the circle, and it isn't. Can you post the code you're using? |
Earacher |
Comment #5: Fri, 15 Feb 2013, 15:31 (GMT+1, DST) Quote: Maarten Baert
Quote: Earacher
That's debug drawing - -. I've just tried, but I really don't know how you made that happen. The debug drawing indicates that in your last image, the anchor point on the circle is placed wrong. Otherwise the orange dot would have been in the center of the circle, and it isn't. Can you post the code you're using? Hi Maarten here is my code: b0 = ep_body_create_dynamic(global.world,false); b1 = ep_body_create_dynamic(global.world,false); slider1 = ep_sliderjoint_create(global.world,b1,b0,0,0,-6,-4,6,-4,0); my intention is sliderjoint b1,b0. b1 doesn't collision with anything just sliderjoint b0. Last modified: Fri, 15 Feb 2013, 15:41 (GMT+1, DST) |
Maarten BaertAdministrator |
Comment #6: Fri, 15 Feb 2013, 17:11 (GMT+1, DST) Quote: Earacher
Hi Maarten here is my code: b0 = ep_body_create_dynamic(global.world,false); b1 = ep_body_create_dynamic(global.world,false); slider1 = ep_sliderjoint_create(global.world,b1,b0,0,0,-6,-4,6,-4,0); my intention is sliderjoint b1,b0. b1 doesn't collision with anything just sliderjoint b0. Springs can become unstable if you use values for k that are way too large, so that's possible. Normally k shouldn't be larger than the mass of the lightest body it is connected to. Damping has some influence too, but not as much as k. Your limits aren't working because maxlimitforce (3rd argument) is zero. Normally you want to set this to a really high value that's normally never reached. |
Earacher |
Comment #7: Sat, 16 Feb 2013, 13:32 (GMT+1, DST) Quote: Maarten Baert
Quote: Earacher
Hi Maarten here is my code: b0 = ep_body_create_dynamic(global.world,false); b1 = ep_body_create_dynamic(global.world,false); slider1 = ep_sliderjoint_create(global.world,b1,b0,0,0,-6,-4,6,-4,0); my intention is sliderjoint b1,b0. b1 doesn't collision with anything just sliderjoint b0. Springs can become unstable if you use values for k that are way too large, so that's possible. Normally k shouldn't be larger than the mass of the lightest body it is connected to. Damping has some influence too, but not as much as k. Your limits aren't working because maxlimitforce (3rd argument) is zero. Normally you want to set this to a really high value that's normally never reached. Hi Maarten. |
Maarten BaertAdministrator |
Comment #8: Sat, 16 Feb 2013, 14:07 (GMT+1, DST) Quote: Earacher
Hi Maarten. I really can't see what's happening on the screenshots, they are too small. Can you send me the GMK? If you don't want everyone to see it, you can also e-mail it (my e-mail address is at the top of the LICENSE.txt file in ExtremePhysics) or send me a PM on the GMC (here). Last modified: Sat, 16 Feb 2013, 14:07 (GMT+1, DST) |
Earacher |
Comment #9: Sat, 16 Feb 2013, 18:28 (GMT+1, DST) Quote: Maarten Baert
Quote: Earacher
Hi Maarten. I really can't see what's happening on the screenshots, they are too small. Can you send me the GMK? If you don't want everyone to see it, you can also e-mail it (my e-mail address is at the top of the LICENSE.txt file in ExtremePhysics) or send me a PM on the GMC (here). Hi Maarten I already sent a E-Mail to you. |
Maarten BaertAdministrator |
Comment #10: Sat, 23 Feb 2013, 17:35 (GMT+1, DST) Quote: Earacher
Hi Maarten I already sent a E-Mail to you. Okay, I figured it out. It's actually really simple: ep_world_set_settings(global.world,0.25,20,0,0.1,0.5,0,0.5,1); The problem is that both position_iterations and baumgarte_factor are 0. This means there is no position correction at all. It's actually surprising that it worked at all :). I recommend setting position_iterations to 5 or 10. That should fix it. |
Earacher |
Comment #11: Sun, 24 Feb 2013, 17:38 (GMT+1, DST) Quote: Maarten Baert
Quote: Earacher
Hi Maarten I already sent a E-Mail to you. Okay, I figured it out. It's actually really simple: ep_world_set_settings(global.world,0.25,20,0,0.1,0.5,0,0.5,1); The problem is that both position_iterations and baumgarte_factor are 0. This means there is no position correction at all. It's actually surprising that it worked at all :). I recommend setting position_iterations to 5 or 10. That should fix it. Thaaank you Maarten,sorry I don't know changing position_iterations affects that. |