Reputation: 13
In a DistanceJointDef you can set localAnchorA and localAnchorB (both are Vector2) with this line:
jointDef.initialize(bodyA, bodyB, localAnchorA, localAnchorB);
However, I haven't seen any way for setting these same parameters in a RopeJointDef, in fact, they are declared as finals in the RopeJointDef class like this:
/** The local anchor point relative to bodyA's origin. **/
public final Vector2 localAnchorA = new Vector2(-1, 0);
/** The local anchor point relative to bodyB's origin. **/
public final Vector2 localAnchorB = new Vector2(1, 0);
So, my question is, is there any way to change these parameters?
Thank you so much in advance!
Upvotes: 1
Views: 1297
Reputation: 1419
We can set the local anchors in rope joint by calling this statements
RopeJointDef ropeJointDef = new RopeJointDef();
ropeJointDef.localAnchorA.set(10,20);
ropeJointDef.localAnchorB.set(10,20);
Upvotes: 2