Difference between revisions of "B2.FrictionJoint"

From GiderosMobile
m (Text replacement - "<source" to "<syntaxhighlight")
Line 11: Line 11:
 
=== Examples ===
 
=== Examples ===
 
'''Friction joint'''
 
'''Friction joint'''
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
--create empty box2d body for joint
 
--create empty box2d body for joint
 
local ground = world:createBody({})
 
local ground = world:createBody({})

Revision as of 17:54, 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

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) </source>

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