Difference between revisions of "B2.createPulleyJointDef"

 
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
<languages />
 
<languages />
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
+
'''Available since:''' Gideros 2011.6<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/b2|b2]]<br/>
+
'''Class:''' [[Special:MyLanguage/b2|b2]]<br/>
=== <translate>Description</translate> ===
+
 
<translate><br />
+
=== Description ===
Creates and returns a pulley joint definition table with the bodies, anchors, lengths, max lengths, and ratio using the world anchors.<br />
+
Creates and returns a pulley joint definition table with the bodies, anchors, lengths, max lengths, and ratio using the world anchors.
(Please refer to [[b2.World:createJoint]] function for more information about all the information needed to create a pulley joint).<br />
+
 
<br /></translate>
+
(Please refer to [[b2.World:createJoint]] function for more information about all the information needed to create a pulley joint).
 
<source lang="lua">
 
<source lang="lua">
 
(table) = b2.createPulleyJointDef(bodyA,bodyB,groundAnchorAx,groundAnchorAy,groundAnchorBx,groundAnchorBy,anchorAx,anchorAy,anchorBx,anchorBy,ratio)
 
(table) = b2.createPulleyJointDef(bodyA,bodyB,groundAnchorAx,groundAnchorAy,groundAnchorBx,groundAnchorBy,anchorAx,anchorAy,anchorBx,anchorBy,ratio)
 
</source>
 
</source>
=== <translate>Parameters</translate> ===
+
 
'''bodyA''': (b2.Body) <translate>the first attached body</translate> <br/>
+
=== Parameters ===
'''bodyB''': (b2.Body) <translate>the second attached body</translate> <br/>
+
'''bodyA''': (b2.Body) the first attached body <br/>
'''groundAnchorAx''': (number) <translate>the x coordinate of the first ground anchor in world coordinates. This point never moves.</translate> <br/>
+
'''bodyB''': (b2.Body) the second attached body <br/>
'''groundAnchorAy''': (number) <translate>the y coordinate of the first ground anchor in world coordinates. This point never moves.</translate> <br/>
+
'''groundAnchorAx''': (number) the x coordinate of the first ground anchor in world coordinates. This point never moves. <br/>
'''groundAnchorBx''': (number) <translate>the x coordinate of the second ground anchor in world coordinates. This point never moves.</translate> <br/>
+
'''groundAnchorAy''': (number) the y coordinate of the first ground anchor in world coordinates. This point never moves. <br/>
'''groundAnchorBy''': (number) <translate>the y coordinate of the second ground anchor in world coordinates. This point never moves.</translate> <br/>
+
'''groundAnchorBx''': (number) the x coordinate of the second ground anchor in world coordinates. This point never moves. <br/>
'''anchorAx''': (number) <translate>the x coordinate of the world anchor point of bodyA</translate> <br/>
+
'''groundAnchorBy''': (number) the y coordinate of the second ground anchor in world coordinates. This point never moves. <br/>
'''anchorAy''': (number) <translate>the y coordinate of the world anchor point of bodyA</translate> <br/>
+
'''anchorAx''': (number) the x coordinate of the world anchor point of bodyA <br/>
'''anchorBx''': (number) <translate>the x coordinate of the world anchor point of bodyB</translate> <br/>
+
'''anchorAy''': (number) the y coordinate of the world anchor point of bodyA <br/>
'''anchorBy''': (number) <translate>the y coordinate of the world anchor point of bodyB</translate> <br/>
+
'''anchorBx''': (number) the x coordinate of the world anchor point of bodyB <br/>
'''ratio''': (number) <translate>the pulley ratio, used to simulate a block-and-tackle</translate> <br/>
+
'''anchorBy''': (number) the y coordinate of the world anchor point of bodyB <br/>
=== <translate>Return values</translate> ===
+
'''ratio''': (number) the pulley ratio, used to simulate a block-and-tackle <br/>
'''<translate>Returns</translate>''' (table) <translate>A new pulley joint definition table</translate><br/>
+
 
=== <translate>Examples</translate> ===
+
=== Return values ===
'''Pulley joint'''<br/>
+
'''Returns''' (table) A new pulley joint definition table<br/>
<source lang="lua">--create empty box2d body for joint
+
 
 +
=== Examples ===
 +
'''Pulley joint'''
 +
<source lang="lua">
 +
--create empty box2d body for joint
 
local ground = world:createBody({})
 
local ground = world:createBody({})
  
Line 36: Line 40:
 
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)
 +
</source>
 +
 
 +
{{B2}}

Latest revision as of 04:52, 17 February 2020


Available since: Gideros 2011.6
Class: b2

Description

Creates and returns a pulley joint definition table with the bodies, anchors, lengths, max lengths, and ratio using the world anchors.

(Please refer to b2.World:createJoint function for more information about all the information needed to create a pulley joint).

(table) = b2.createPulleyJointDef(bodyA,bodyB,groundAnchorAx,groundAnchorAy,groundAnchorBx,groundAnchorBy,anchorAx,anchorAy,anchorBx,anchorBy,ratio)

Parameters

bodyA: (b2.Body) the first attached body
bodyB: (b2.Body) the second attached body
groundAnchorAx: (number) the x coordinate of the first ground anchor in world coordinates. This point never moves.
groundAnchorAy: (number) the y coordinate of the first ground anchor in world coordinates. This point never moves.
groundAnchorBx: (number) the x coordinate of the second ground anchor in world coordinates. This point never moves.
groundAnchorBy: (number) the y coordinate of the second ground anchor in world coordinates. This point never moves.
anchorAx: (number) the x coordinate of the world anchor point of bodyA
anchorAy: (number) the y coordinate of the world anchor point of bodyA
anchorBx: (number) the x coordinate of the world anchor point of bodyB
anchorBy: (number) the y coordinate of the world anchor point of bodyB
ratio: (number) the pulley ratio, used to simulate a block-and-tackle

Return values

Returns (table) A new pulley joint definition table

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)





LiquidFun