This project has moved. For the latest updates, please go here.

Climbable Ropes

Jan 20, 2009 at 8:01 AM
First of all thanks for the wonderful physics engine. Secondly, I'm hoping someone could help me figure out how to make a climbable rope in farseer. I have some ropes and chains set up nicely from the ComplexFactory, and a player object, which is basically just a square body and geom.

I tried making the player jump from segment body to segment body on the rope by moving the player to the location of the next rope segment body, and applying a new revolute joint, but it is very jerky and not the smooth climbing action i'm looking for.

Has anyone done this before? Please help!
Jan 20, 2009 at 8:17 AM
Hey Superfish welcome to this forum! I haven't used the ComplexFactory much but try making a spring with a fairly short target length and enough strength to lift your player, then attaching it to both your player and a link on the chain. Then set up code to determine if the player is close enough to the target link, and if it is move the spring's attachment (the one that is already attached to the rope). onto the next link  There might be better ways to do this but that is all i can think of right now.
Jan 20, 2009 at 10:29 AM
Box2D has something called a Mouse Joint that you can use to make a body follow a world point. You can use something like that to move your player up the rope. (I would think).
Box2D is somewhat like Farseer Physics (or the other way around) and you should be able to implement the mouse joint in Farseer Physics without to much trouble.
Jan 29, 2009 at 10:17 AM
Thanks guys, I solved it by making the player move from segment to segment as i had done previously, but in between movements I used Vector2.Lerp to interpolate a line between two segments (player on one segment, other segment above, or below player), and kind of slid the player up (or down) at a set speed along the interpolated line until the new segment is reached.