MotorJoint - 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

MotorJoint - missing functions?

Post by Nikki »

Hiya,

I'm learning and experimenting with love2d physics library,
Specifically The MotorJoint, in the wiki (https://love2d.org/wiki/MotorJoint) it is summarized like
Controls the relative motion between two Bodies. Position and rotation offsets can be specified, as well as the maximum motor force and torque that will be applied to reach the target offsets.'
But it just offers function to get and set linear and angular offsets, it doesn't offer ways to set the force and torque it can apply to the second body for it to 'control the motion' as far as I can tell.

WhenI look at the box2d docs (https://box2d.org/documentation/group__ ... joint.html) their motorjoint also has:

Code: Select all

void 	b2MotorJoint_SetMaxForce (b2JointId jointId, float maxForce)
 	Set the motor joint maximum force, typically in newtons.
 
float 	b2MotorJoint_GetMaxForce (b2JointId jointId)
 	Get the motor joint maximum force, typically in newtons.
 
void 	b2MotorJoint_SetMaxTorque (b2JointId jointId, float maxTorque)
 	Set the motor joint maximum torque, typically in newton-meters.
 
float 	b2MotorJoint_GetMaxTorque (b2JointId jointId)
 	Get the motor joint maximum torque, typically in newton-meters.
These functions seem missing from love2d MotorJoint or am I missing something else?
User avatar
Nikki
Citizen
Posts: 87
Joined: Wed Jan 25, 2017 5:42 pm

Re: MotorJoint - missing functions?

Post by Nikki »

edit: ok I was missing some undocumented functions, my intellisense was saying they were wrong but i could after inspect the joint like so

Code: Select all

print(inspect(getmetatable(joint)))

I spotted the functions i was looking for :

Code: Select all

  setCorrectionFactor = <function 20>,
  setMaxForce = <function 22>,
  setMaxTorque = <function 23>,
User avatar
slime
Solid Snayke
Posts: 3166
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: MotorJoint - missing functions?

Post by slime »

love currently uses Box2D 2, which is significantly different in many areas from the freshly released box2D 3 (whose docs are on the linked page), for what it's worth.
Post Reply

Who is online

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