Adjusting Rope Joint Anchor points

I found how to make a true Rope joint in Corona, but cannot figure out how to set the anchor points. Apparently in C, it doesn’t take initialization parameters unlike the pivot, so you just do this:

local ropeJoint = physics.newJoint(“rope”, bodyA, bodyB)

Unfortunately, that makes the rope attach in the middle of the bodies. Distance and Pivot joints, in Corona, can have their anchor points set in the constructor/newJoint method to define the actual joint point.

I haven’t figured out how to iterate over user data, and not all of the C methods/properties are exposed in Corona so… I’m basically stuck trying to figure out how to set a Rope joint’s anchor points. No, localAnchorA and B do not work, heh. [import]uid: 23693 topic_id: 35881 reply_id: 335881[/import]

Figured it out; you CAN pass things into the constructor. I thought they were bogus values, but you have to map them to global coordinates first to work.

local mappedX, mappedY = sphere:contentToLocal(sphere.x, sphere.y + sphere.height / 2)
secondGrappleLine = physics.newJoint(“rope”, sphere, point, mappedX, mappedY)

That’ll attach the rope on the bottom. w00t!

Also, the length is maxLength for a Rope joint, not length like for a Distance joint.

Y’all have a job opening for a documentation writer? [import]uid: 23693 topic_id: 35881 reply_id: 142643[/import]

Figured it out; you CAN pass things into the constructor. I thought they were bogus values, but you have to map them to global coordinates first to work.

local mappedX, mappedY = sphere:contentToLocal(sphere.x, sphere.y + sphere.height / 2)
secondGrappleLine = physics.newJoint(“rope”, sphere, point, mappedX, mappedY)

That’ll attach the rope on the bottom. w00t!

Also, the length is maxLength for a Rope joint, not length like for a Distance joint.

Y’all have a job opening for a documentation writer? [import]uid: 23693 topic_id: 35881 reply_id: 142643[/import]

How come the rope joint is not documented at all?

How come the rope joint is not documented at all?