Difference between revisions of "B2.DistanceJoint"

From GiderosMobile
Line 2: Line 2:
 
'''Supported platforms:''' android, ios, mac, pc<br/>
 
'''Supported platforms:''' android, ios, mac, pc<br/>
 
'''Available since:''' Gideros 2011.6<br/>
 
'''Available since:''' Gideros 2011.6<br/>
=== Description ===
+
=== <translate>Description</translate> ===
 
<translate><br />
 
<translate><br />
 
A distance joint constrains two points on two bodies to remain at a fixed distance from each other. You can view this as a massless, rigid rod. <br />
 
A distance joint constrains two points on two bodies to remain at a fixed distance from each other. You can view this as a massless, rigid rod. <br />
 
<br /></translate>
 
<br /></translate>
=== Examples ===
+
=== <translate>Examples</translate> ===
 
'''Distance joint'''<br/>
 
'''Distance joint'''<br/>
 
<source lang="lua">local jointDef = b2.createDistanceJointDef(body1, body2, 100, 100, 200, 100)
 
<source lang="lua">local jointDef = b2.createDistanceJointDef(body1, body2, 100, 100, 200, 100)
Line 17: Line 17:
 
{|-
 
{|-
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
=== Methods ===
+
=== <translate>Methods</translate> ===
 
[[Special:MyLanguage/b2.DistanceJoint:getDampingRatio|b2.DistanceJoint:getDampingRatio]] ''<translate>returns the damping ratio</translate>''<br/>
 
[[Special:MyLanguage/b2.DistanceJoint:getDampingRatio|b2.DistanceJoint:getDampingRatio]] ''<translate>returns the damping ratio</translate>''<br/>
 
[[Special:MyLanguage/b2.DistanceJoint:getFrequency|b2.DistanceJoint:getFrequency]] ''<translate>returns the mass-spring-damper frequency in Hertz</translate>''<br/>
 
[[Special:MyLanguage/b2.DistanceJoint:getFrequency|b2.DistanceJoint:getFrequency]] ''<translate>returns the mass-spring-damper frequency in Hertz</translate>''<br/>
Line 25: Line 25:
 
[[Special:MyLanguage/b2.DistanceJoint:setLength|b2.DistanceJoint:setLength]] ''<translate>sets the natural joint length in meters</translate>''<br/>
 
[[Special:MyLanguage/b2.DistanceJoint:setLength|b2.DistanceJoint:setLength]] ''<translate>sets the natural joint length in meters</translate>''<br/>
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
=== Events ===
+
=== <translate>Events</translate> ===
=== Constants ===
+
=== <translate>Constants</translate> ===
 
|}
 
|}

Revision as of 07:30, 24 August 2018

Supported platforms: android, ios, mac, pc
Available since: Gideros 2011.6

Description


A distance joint constrains two points on two bodies to remain at a fixed distance from each other. You can view this as a massless, rigid rod.

Examples

Distance joint

local jointDef = b2.createDistanceJointDef(body1, body2, 100, 100, 200, 100)
local distanceJoint = world:createJoint(jointDef)
--by default length between two bodies is the length they have between them when joint was created
--but it is possilbe to change it using
distanceJoint:setLength(200)
distanceJoint:setDampingRatio(0.5)
distanceJoint:setFrequency(4)

Methods

b2.DistanceJoint:getDampingRatio returns the damping ratio
b2.DistanceJoint:getFrequency returns the mass-spring-damper frequency in Hertz
b2.DistanceJoint:getLength returns the length of this distance joint in meters
b2.DistanceJoint:setDampingRatio sets the damping ratio (0 = no damping, 1 = critical damping)
b2.DistanceJoint:setFrequency sets the mass-spring-damper frequency in Hertz
b2.DistanceJoint:setLength sets the natural joint length in meters

Events

Constants