Difference between revisions of "B2.PulleyJoint"

From GiderosMobile
m (Text replacement - "</source" to "</syntaxhighlight")
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
'''Supported platforms:''' android, ios, mac, pc<br/>
+
<languages />
'''Available since:''' Gideros 2011.6<br/>
+
<!-- GIDEROSOBJ:b2.PulleyJoint -->
 +
'''<translate>Supported platforms</translate>:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/>
 +
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
 +
'''<translate>Inherits from</translate>:''' [[Special:MyLanguage/b2.Joint|b2.Joint]]<br/>
 +
 
 
=== <translate>Description</translate> ===
 
=== <translate>Description</translate> ===
<translate><br />
+
The pulley joint is connected to two bodies and two fixed ground points. The pulley supports a ratio such that: length1  ratio * length2 <= constant Yes, the force transmitted is scaled by the ratio. The pulley also enforces a maximum length limit on both sides. This is useful to prevent one side of the pulley hitting the top.
The pulley joint is connected to two bodies and two fixed ground points. The pulley supports a ratio such that: length1  ratio * length2 &lt;= constant Yes, the force transmitted is scaled by the ratio. The pulley also enforces a maximum length limit on both sides. This is useful to prevent one side of the pulley hitting the top. <br />
+
 
<br /></translate>
 
 
=== <translate>Examples</translate> ===
 
=== <translate>Examples</translate> ===
'''Pulley joint'''<br/>
+
'''Pulley joint'''
<source lang="lua">--create empty box2d body for joint
+
<syntaxhighlight lang="lua">
 +
--create empty box2d body for joint
 
local ground = world:createBody({})
 
local ground = world:createBody({})
  
Line 17: Line 21:
 
350, 300, --coordinates where "imaginary string" is attached in the body 2
 
350, 300, --coordinates where "imaginary string" is attached in the body 2
 
1) -- ratio (if < 1 -> makes body 2 heavier, > 1 makes body 1 heavier, =1 makes them equal
 
1) -- ratio (if < 1 -> makes body 2 heavier, > 1 makes body 1 heavier, =1 makes them equal
local pulleyJoint = world:createJoint(jointDef)</source>
+
local pulleyJoint = world:createJoint(jointDef)
 +
</syntaxhighlight>
 +
 
 
{|-
 
{|-
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
 
=== <translate>Methods</translate> ===
 
=== <translate>Methods</translate> ===
[[Special:MyLanguage/b2.PulleyJoint:getGroundAnchorA|b2.PulleyJoint:getGroundAnchorA]] ''<translate>returns the x and y coordinates of the first ground anchor</translate>''<br/>
+
[[Special:MyLanguage/b2.PulleyJoint:getGroundAnchorA|b2.PulleyJoint:getGroundAnchorA]] ''<translate>returns the x and y coordinates of the first ground anchor</translate>''<br/><!-- GIDEROSMTD:b2.PulleyJoint:getGroundAnchorA() returns the x and y coordinates of the first ground anchor -->
[[Special:MyLanguage/b2.PulleyJoint:getGroundAnchorB|b2.PulleyJoint:getGroundAnchorB]] ''<translate>returns the x and y coordinates of the second ground anchor</translate>''<br/>
+
[[Special:MyLanguage/b2.PulleyJoint:getGroundAnchorB|b2.PulleyJoint:getGroundAnchorB]] ''<translate>returns the x and y coordinates of the second ground anchor</translate>''<br/><!-- GIDEROSMTD:b2.PulleyJoint:getGroundAnchorB() returns the x and y coordinates of the second ground anchor -->
[[Special:MyLanguage/b2.PulleyJoint:getLengthA|b2.PulleyJoint:getLengthA]] ''<translate>returns the current length of the segment attached to bodyA</translate>''<br/>
+
[[Special:MyLanguage/b2.PulleyJoint:getLengthA|b2.PulleyJoint:getLengthA]] ''<translate>returns the current length of the segment attached to bodyA</translate>''<br/><!-- GIDEROSMTD:b2.PulleyJoint:getLengthA() returns the current length of the segment attached to bodyA -->
[[Special:MyLanguage/b2.PulleyJoint:getLengthB|b2.PulleyJoint:getLengthB]] ''<translate>returns the current length of the segment attached to bodyB</translate>''<br/>
+
[[Special:MyLanguage/b2.PulleyJoint:getLengthB|b2.PulleyJoint:getLengthB]] ''<translate>returns the current length of the segment attached to bodyB</translate>''<br/><!-- GIDEROSMTD:b2.PulleyJoint:getLengthB() returns the current length of the segment attached to bodyB -->
[[Special:MyLanguage/b2.PulleyJoint:getRatio|b2.PulleyJoint:getRatio]] ''<translate>returns the joint ratio</translate>''<br/>
+
[[Special:MyLanguage/b2.PulleyJoint:getRatio|b2.PulleyJoint:getRatio]] ''<translate>returns the joint ratio</translate>''<br/><!-- GIDEROSMTD:b2.PulleyJoint:getRatio() returns the joint ratio -->
 +
 
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
 
=== <translate>Events</translate> ===
 
=== <translate>Events</translate> ===
 
=== <translate>Constants</translate> ===
 
=== <translate>Constants</translate> ===
 
|}
 
|}
 +
 +
----
 +
*'''[[B2.Joint]]'''
 +
*'''[[LiquidFun]]'''

Latest revision as of 16:55, 12 July 2023


Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.pngPlatform html5.pngPlatform winrt.pngPlatform win32.png
Available since: Gideros 2011.6
Inherits from: b2.Joint

Description

The pulley joint is connected to two bodies and two fixed ground points. The pulley supports a ratio such that: length1 ratio * length2 <= constant Yes, the force transmitted is scaled by the ratio. The pulley also enforces a maximum length limit on both sides. This is useful to prevent one side of the pulley hitting the top.

Examples

Pulley joint

--create empty box2d body for joint
local ground = world:createBody({})

local jointDef = b2.createPulleyJointDef(body1, body2, 
	200, 100, --coordinates where "imaginary string" is attached in the air for body 1
	350, 100, --coordinates where "imaginary string" is attached in the air for body 2
	200, 300, --coordinates where "imaginary string" is attached to the body 1
	350, 300, --coordinates where "imaginary string" is attached in the body 2
	1) -- ratio (if < 1 -> makes body 2 heavier, > 1 makes body 1 heavier, =1 makes them equal
local pulleyJoint = world:createJoint(jointDef)

Methods

b2.PulleyJoint:getGroundAnchorA returns the x and y coordinates of the first ground anchor
b2.PulleyJoint:getGroundAnchorB returns the x and y coordinates of the second ground anchor
b2.PulleyJoint:getLengthA returns the current length of the segment attached to bodyA
b2.PulleyJoint:getLengthB returns the current length of the segment attached to bodyB
b2.PulleyJoint:getRatio returns the joint ratio

Events

Constants