Difference between revisions of "B2.FrictionJoint"
From GiderosMobile
(18 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | '''Supported platforms:''' android | + | <!-- GIDEROSOBJ:b2.FrictionJoint --> |
+ | '''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/> | ||
'''Available since:''' Gideros 2011.6<br/> | '''Available since:''' Gideros 2011.6<br/> | ||
+ | '''Inherits from:''' [[b2.Joint]]<br/> | ||
+ | |||
=== Description === | === Description === | ||
− | + | Friction joint. This is used for top-down friction. It provides 2D translational friction and angular friction. | |
− | Friction joint. This is used for top-down friction. It provides 2D translational friction and angular friction. < | + | |
− | < | + | === Examples === |
+ | '''Friction joint''' | ||
+ | <syntaxhighlight lang="lua"> | ||
+ | --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) | ||
+ | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{|- | {|- | ||
− | | style="width: 50%;"| | + | | style="width: 50%; vertical-align:top;"| |
=== Methods === | === Methods === | ||
− | [[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--> |
− | [[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--> |
− | [[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--> |
− | [[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%;"| | + | |
+ | | style="width: 50%; vertical-align:top;"| | ||
=== Events === | === Events === | ||
=== Constants === | === Constants === | ||
|} | |} | ||
+ | |||
+ | ---- | ||
+ | *'''[[B2.Joint]]''' | ||
+ | *'''[[LiquidFun]]''' |
Latest revision as of 01:54, 1 December 2023
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)
Methodsb2.FrictionJoint:getMaxForce returns the maximum friction force in N |
EventsConstants |