Distance joints not working as described: can't set dampingRatio

I’ve noticed that the attributes that are said to apply to a distance joint are not working right.

http://developer.anscamobile.com/content/game-edition-physics-joints

Whenever I try to set frequency or dampingRatio, the latter instruction is effective, as if I had set the frequency only. The dampingRatio cannot be manipulated. Setting joint.length is also ineffective.

myJoint.frequency = 4711 – IGNORED
myJoint.dampingRatio = 2

Effect: frequency(!) will be 2, and dampingRatio remains 0.

myJoint2.dampingRatio = 4711 – IGNORED
myJoint2.frequency = 2

Same effect: frequency will be 2, and dampingRatio remains 0.

Also, http://developer.anscamobile.com/reference/index/jointlength suggests that the joint length of distance joints can be set and read. However, setting it seems to have no effect whatsoever.

Here’s my example code:

  
local physics = require( "physics" )  
physics.start()  
physics.setDrawMode( "debug" )  
  
local ground = display.newRect( 1,445,319,34)  
physics.addBody( ground, "static", { friction=0.5, bounce=0.3 } )  
  
local rect = display.newRect(60,180,60,60)  
local crate = display.newRect(60,280,60,60)  
local rect2 = display.newRect(200,180,60,60)  
local crate2 = display.newRect(200,280,60,60)  
  
physics.addBody( rect, { density=500.0, friction=0.5, bounce=0.3 } )  
physics.addBody( crate, { density=500.0, friction=0.5, bounce=0.3 } )  
physics.addBody( rect2, { density=500.0, friction=0.5, bounce=0.3 } )  
physics.addBody( crate2,{ density=500.0, friction=0.5, bounce=0.3 } )  
  
local myJoint = physics.newJoint( "distance", crate, rect, crate.x, crate.y, rect.x, rect.y )  
local myJoint2 = physics.newJoint( "distance", crate2, rect2, crate2.x, crate2.y, rect2.x,rect2.y )  
  
print("BEFORE myJoint.frequency="..myJoint.frequency .. " myJoint.dampingRatio="..myJoint.dampingRatio)  
myJoint.length = 1 -- IGNORED  
myJoint.frequency = 4711 -- IGNORED  
myJoint.dampingRatio = 2  
print("AFTER: myJoint.frequency="..myJoint.frequency .. " myJoint.dampingRatio="..myJoint.dampingRatio)  
  
print("BEFORE myJoint2.frequency="..myJoint2.frequency .. " myJoint2.dampingRatio="..myJoint2.dampingRatio)  
myJoint.length = 10000 -- IGNORED  
myJoint2.dampingRatio = 4711 -- IGNORED  
myJoint2.frequency = 2  
print("AFTER: myJoint2.frequency="..myJoint2.frequency .. " myJoint2.dampingRatio="..myJoint2.dampingRatio)  

You’ll see in the console output that the frequency is set for both joints yet the dampingRatio is 0.

The objects also behave the exact same way.

I’m doing something wrong or is that really a bug? I really do suspect the latter. [import]uid: 85260 topic_id: 14869 reply_id: 314869[/import]

+1 Please can one of the staff investigate this issue and confirm whether it is indeed a bug as we have run into precisely the same issue. [import]uid: 87279 topic_id: 14869 reply_id: 57402[/import]

I think it’s a bug. I had also submitted also a proper bug report (#8043) with essentially the same content two weeks ago.

Corona’s integration with the box2d engine is a major selling point for this SDK. It also attracted me to become a paying user.

Hopefully the team can address this soon and at least acknowledge the problem.

A fix would be even better of course! :slight_smile: [import]uid: 85260 topic_id: 14869 reply_id: 57859[/import]

Thank you for posting a bug #

Will bring this up in our next meeting :slight_smile:

Peach [import]uid: 52491 topic_id: 14869 reply_id: 57955[/import]

Just so you know Peach, we must’ve overlooked Markus’ bug report and filed a similar bug regarding not being able to set joint.length and joint.dampingRatio (ours is #8291). It’d be very much appreciated if you could check both of these in tandem as they’re probably the same. [import]uid: 87279 topic_id: 14869 reply_id: 57972[/import]

Thanks for that - I’ve made a note of it. [import]uid: 52491 topic_id: 14869 reply_id: 58152[/import]