B2.FrictionJoint: Difference between revisions

From GiderosMobile
No edit summary
No edit summary
Line 2: Line 2:
<languages />
<languages />
<!-- GIDEROSOBJ:b2.FrictionJoint -->
<!-- GIDEROSOBJ:b2.FrictionJoint -->
'''<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/>
'''Supported platforms:''' [[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/>
'''Available since:''' Gideros 2011.6<br/>
'''<translate>Inherits from</translate>:''' [[Special:MyLanguage/b2.Joint|b2.Joint]]<br/>
'''Inherits from:''' [[Special:MyLanguage/b2.Joint|b2.Joint]]<br/>
=== <translate>Description</translate> ===
 
<translate><br />
=== Description ===
Friction joint. This is used for top-down friction. It provides 2D translational friction and angular friction. <br />
Friction joint. This is used for top-down friction. It provides 2D translational friction and angular friction.
<br /></translate>
 
=== <translate>Examples</translate> ===
=== Examples ===
'''Friction joint'''<br/>
'''Friction joint'''
<source lang="lua">--create empty box2d body for joint
<source lang="lua">
--create empty box2d body for joint
local ground = world:createBody({})
local ground = world:createBody({})
ground:setPosition(350, 480)
ground:setPosition(350, 480)
Line 20: Line 21:


--set maximum friction force to slow down the ball
--set maximum friction force to slow down the ball
frictionJoint:setMaxForce(100)</source>
frictionJoint:setMaxForce(100)
</source>
 
{|-
{|-
| style="width: 50%; vertical-align:top;"|
| style="width: 50%; vertical-align:top;"|
=== <translate>Methods</translate> ===
=== Methods ===
[[Special:MyLanguage/b2.FrictionJoint:getMaxForce|b2.FrictionJoint:getMaxForce]] ''<translate>returns the maximum friction force in N</translate>''<br/><!-- GIDEROSMTD:b2.FrictionJoint:getMaxForce() returns the maximum friction force in N -->
[[Special:MyLanguage/b2.FrictionJoint:getMaxForce|b2.FrictionJoint:getMaxForce]] ''returns the maximum friction force in N''<br/><!-- GIDEROSMTD:b2.FrictionJoint:getMaxForce() returns the maximum friction force in N -->
[[Special:MyLanguage/b2.FrictionJoint:getMaxTorque|b2.FrictionJoint:getMaxTorque]] ''<translate>returns the maximum friction torque in N*m</translate>''<br/><!-- GIDEROSMTD:b2.FrictionJoint:getMaxTorque() returns the maximum friction torque in N*m -->
[[Special:MyLanguage/b2.FrictionJoint:getMaxTorque|b2.FrictionJoint:getMaxTorque]] ''returns the maximum friction torque in N*m''<br/><!-- GIDEROSMTD:b2.FrictionJoint:getMaxTorque() returns the maximum friction torque in N*m -->
[[Special:MyLanguage/b2.FrictionJoint:setMaxForce|b2.FrictionJoint:setMaxForce]] ''<translate>sets the maximum friction force in N</translate>''<br/><!-- GIDEROSMTD:b2.FrictionJoint:setMaxForce(force) sets the maximum friction force in N -->
[[Special:MyLanguage/b2.FrictionJoint:setMaxForce|b2.FrictionJoint:setMaxForce]] ''sets the maximum friction force in N''<br/><!-- GIDEROSMTD:b2.FrictionJoint:setMaxForce(force) sets the maximum friction force in N -->
[[Special:MyLanguage/b2.FrictionJoint:setMaxTorque|b2.FrictionJoint:setMaxTorque]] ''<translate>sets the maximum friction torque in N*m</translate>''<br/><!-- GIDEROSMTD:b2.FrictionJoint:setMaxTorque(torque) sets the maximum friction torque in N*m -->
[[Special:MyLanguage/b2.FrictionJoint:setMaxTorque|b2.FrictionJoint:setMaxTorque]] ''sets the maximum friction torque in N*m''<br/><!-- GIDEROSMTD:b2.FrictionJoint:setMaxTorque(torque) sets the maximum friction torque in N*m -->
 
| style="width: 50%; vertical-align:top;"|
| style="width: 50%; vertical-align:top;"|
=== <translate>Events</translate> ===
=== Events ===
=== <translate>Constants</translate> ===
=== Constants ===
|}
|}
----
*'''[[LiquidFun]]'''

Revision as of 11:52, 17 February 2020


Supported platforms:
Available since: Gideros 2011.6
Inherits from: b2.Joint

Description

Friction joint. This is used for top-down friction. It provides 2D translational friction and angular friction.

Examples

Friction joint

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

--create friction joint
local jointDef = b2.createFrictionJointDef(body, ground, 350, 200)
local frictionJoint = world:createJoint(jointDef)

--set maximum friction force to slow down the ball
frictionJoint:setMaxForce(100)

Methods

b2.FrictionJoint:getMaxForce returns the maximum friction force in N
b2.FrictionJoint:getMaxTorque returns the maximum friction torque in N*m
b2.FrictionJoint:setMaxForce sets the maximum friction force in N
b2.FrictionJoint:setMaxTorque sets the maximum friction torque in N*m

Events

Constants