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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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)
views:1306 update:2011/10/11 15:24:38
corona forums © 2003-2011