PulleyJoint is missing functions ?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Nikki
Citizen
Posts: 87
Joined: Wed Jan 25, 2017 5:42 pm

PulleyJoint is missing functions ?

Post by Nikki »

ok I think I found another weird Joint, but then again it could be me too:
the PulleyJoint, when i inspect its functionality I see these functions:

Code: Select all

<1>{
  __eq = <function 1>,
  __gc = <function 2>,
  __index = <table 1>,
  __tostring = <function 3>,
  destroy = <function 4>,
  getAnchors = <function 5>,
  getBodies = <function 6>,
  getCollideConnected = <function 7>,
  getGroundAnchors = <function 8>,
  getLengthA = <function 9>,
  getLengthB = <function 10>,
  getRatio = <function 11>,
  getReactionForce = <function 12>,
  getReactionTorque = <function 13>,
  getType = <function 14>,
  getUserData = <function 15>,
  isDestroyed = <function 16>,
  release = <function 17>,
  setUserData = <function 18>,
  type = <function 19>,
  typeOf = <function 20>
}
basically no separate setX functions,


but according to the doc there ought to be :
PulleyJoint:setConstant Set the total length of the rope.
PulleyJoint:setMaxLengths Set the maximum lengths of the rope segments.
PulleyJoint:setRatio

my autocomplete seems to think there are these setters too, but when i use them
'attempt to call method 'setMaxLengths' (a nil value)'

also in the PulleyJoint constructor doc there is this line:
Pulley joints can behave unpredictably if one side is fully extended. It is recommended that the method setMaxLengths be used to constrain the maximum lengths each side can attain.

but no way todo that I think?


edit: I found this github issue about it: https://github.com/love2d/love/issues/1823, so it seems a similar case like the MotorJoint, the box2d implementationwe have in love is at v2, the api in the wiki is another newer version.
because looking at some old api doc for box2d I see this, very similar to the function i see when inspecting the joint :

Code: Select all

Public Member Functions
b2Vec2 GetAnchor1 () const Get the anchor point on body1 in world coordinates.
b2Vec2 GetAnchor2 () const Get the anchor point on body2 in world coordinates.
b2Vec2 GetReactionForce () const Get the reaction force on body2 at the joint anchor.
float32 GetReactionTorque () const Get the reaction torque on body2.
b2Vec2 GetGroundAnchor1 () const Get the first ground anchor.
b2Vec2 GetGroundAnchor2 () const Get the second ground anchor.
float32 GetLength1 () const Get the current length of the segment attached to body1.
float32 GetLength2 () const Get the current length of the segment attached to body2.
float32 GetRatio () const Get the pulley ratio.
edit2: I guess i can just add another rope joint or 2 to mimic the maxlength behavior
User avatar
dusoft
Party member
Posts: 752
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: PulleyJoint is missing functions ?

Post by dusoft »

Which Love2D version are you using? Also, did you check the Love2D docs and not the Box2D docs? The implementation is different. (also see slime's answer in your other thread). Also: no need to open two threads regarding the issue you have.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 5 guests