Difference between revisions of "B2.PrismaticJoint"

From GiderosMobile
Line 2: Line 2:
 
<languages />
 
<languages />
 
<!-- GIDEROSOBJ:b2.PrismaticJoint -->
 
<!-- GIDEROSOBJ:b2.PrismaticJoint -->
'''<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 ===
A prismatic joint. This joint provides one degree of freedom: translation along an axis fixed in body1. Relative rotation is prevented. You can use a joint limit to restrict the range of motion and a joint motor to drive the motion or to model joint friction. <br />
+
A prismatic joint. This joint provides one degree of freedom: translation along an axis fixed in body1. Relative rotation is prevented. You can use a joint limit to restrict the range of motion and a joint motor to drive the motion or to model joint friction.
<br /></translate>
+
 
=== <translate>Examples</translate> ===
+
=== Examples ===
'''Prismatic joint'''<br/>
+
'''Prismatic 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(465, 480)
 
ground:setPosition(465, 480)
  
--axisx, axisy values usually between 0 and 1
+
--axisx, axisy values usually between 0 and 1
--0 0 moves freely
+
--0 0 moves freely
--0 1 moves on y axis
+
--0 1 moves on y axis
--1 0 moves on x axis
+
--1 0 moves on x axis
--1 1 moves on diagonal
+
--1 1 moves on diagonal
 
local jointDef = b2.createPrismaticJointDef(body, ground, 350, 100, 0.3, 1)
 
local jointDef = b2.createPrismaticJointDef(body, ground, 350, 100, 0.3, 1)
local prismaticJoint = world:createJoint(jointDef)</source>
+
local prismaticJoint = world:createJoint(jointDef)
 +
</source>
 +
 
 
{|-
 
{|-
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
=== <translate>Methods</translate> ===
+
=== Methods ===
[[Special:MyLanguage/b2.PrismaticJoint:enableLimit|b2.PrismaticJoint:enableLimit]] ''<translate>enables or disables the joint limit</translate>''<br/><!-- GIDEROSMTD:b2.PrismaticJoint:enableLimit(flag) enables or disables the joint limit -->
+
[[Special:MyLanguage/b2.PrismaticJoint:enableLimit|b2.PrismaticJoint:enableLimit]] ''enables or disables the joint limit''<br/><!-- GIDEROSMTD:b2.PrismaticJoint:enableLimit(flag) enables or disables the joint limit -->
[[Special:MyLanguage/b2.PrismaticJoint:enableMotor|b2.PrismaticJoint:enableMotor]] ''<translate>enables or disables the joint motor</translate>''<br/><!-- GIDEROSMTD:b2.PrismaticJoint:enableMotor(flag) enables or disables the joint motor -->
+
[[Special:MyLanguage/b2.PrismaticJoint:enableMotor|b2.PrismaticJoint:enableMotor]] ''enables or disables the joint motor''<br/><!-- GIDEROSMTD:b2.PrismaticJoint:enableMotor(flag) enables or disables the joint motor -->
[[Special:MyLanguage/b2.PrismaticJoint:getJointSpeed|b2.PrismaticJoint:getJointSpeed]] ''<translate>returns the current joint translation speed in meters per second</translate>''<br/><!-- GIDEROSMTD:b2.PrismaticJoint:getJointSpeed() returns the current joint translation speed in meters per second -->
+
[[Special:MyLanguage/b2.PrismaticJoint:getJointSpeed|b2.PrismaticJoint:getJointSpeed]] ''returns the current joint translation speed in meters per second''<br/><!-- GIDEROSMTD:b2.PrismaticJoint:getJointSpeed() returns the current joint translation speed in meters per second -->
[[Special:MyLanguage/b2.PrismaticJoint:getJointTranslation|b2.PrismaticJoint:getJointTranslation]] ''<translate>returns the current joint translation in meters</translate>''<br/><!-- GIDEROSMTD:b2.PrismaticJoint:getJointTranslation() returns the current joint translation in meters -->
+
[[Special:MyLanguage/b2.PrismaticJoint:getJointTranslation|b2.PrismaticJoint:getJointTranslation]] ''returns the current joint translation in meters''<br/><!-- GIDEROSMTD:b2.PrismaticJoint:getJointTranslation() returns the current joint translation in meters -->
[[Special:MyLanguage/b2.PrismaticJoint:getLimits|b2.PrismaticJoint:getLimits]] ''<translate>returns the lower and upper joint limits in meters</translate>''<br/><!-- GIDEROSMTD:b2.PrismaticJoint:getLimits() returns the lower and upper joint limits in meters -->
+
[[Special:MyLanguage/b2.PrismaticJoint:getLimits|b2.PrismaticJoint:getLimits]] ''returns the lower and upper joint limits in meters''<br/><!-- GIDEROSMTD:b2.PrismaticJoint:getLimits() returns the lower and upper joint limits in meters -->
[[Special:MyLanguage/b2.PrismaticJoint:getMotorSpeed|b2.PrismaticJoint:getMotorSpeed]] ''<translate>returns the motor speed in meters per second</translate>''<br/><!-- GIDEROSMTD:b2.PrismaticJoint:getMotorSpeed() returns the motor speed in meters per second -->
+
[[Special:MyLanguage/b2.PrismaticJoint:getMotorSpeed|b2.PrismaticJoint:getMotorSpeed]] ''returns the motor speed in meters per second''<br/><!-- GIDEROSMTD:b2.PrismaticJoint:getMotorSpeed() returns the motor speed in meters per second -->
[[Special:MyLanguage/b2.PrismaticJoint:isLimitEnabled|b2.PrismaticJoint:isLimitEnabled]] ''<translate>is the joint limit enabled?</translate>''<br/><!-- GIDEROSMTD:b2.PrismaticJoint:isLimitEnabled() is the joint limit enabled? -->
+
[[Special:MyLanguage/b2.PrismaticJoint:isLimitEnabled|b2.PrismaticJoint:isLimitEnabled]] ''is the joint limit enabled?''<br/><!-- GIDEROSMTD:b2.PrismaticJoint:isLimitEnabled() is the joint limit enabled? -->
[[Special:MyLanguage/b2.PrismaticJoint:isMotorEnabled|b2.PrismaticJoint:isMotorEnabled]] ''<translate>is the joint motor enabled?</translate>''<br/><!-- GIDEROSMTD:b2.PrismaticJoint:isMotorEnabled() is the joint motor enabled? -->
+
[[Special:MyLanguage/b2.PrismaticJoint:isMotorEnabled|b2.PrismaticJoint:isMotorEnabled]] ''is the joint motor enabled?''<br/><!-- GIDEROSMTD:b2.PrismaticJoint:isMotorEnabled() is the joint motor enabled? -->
[[Special:MyLanguage/b2.PrismaticJoint:setLimits|b2.PrismaticJoint:setLimits]] ''<translate>sets the joint limits in meters</translate>''<br/><!-- GIDEROSMTD:b2.PrismaticJoint:setLimits(lower,upper) sets the joint limits in meters -->
+
[[Special:MyLanguage/b2.PrismaticJoint:setLimits|b2.PrismaticJoint:setLimits]] ''sets the joint limits in meters''<br/><!-- GIDEROSMTD:b2.PrismaticJoint:setLimits(lower,upper) sets the joint limits in meters -->
[[Special:MyLanguage/b2.PrismaticJoint:setMaxMotorForce|b2.PrismaticJoint:setMaxMotorForce]] ''<translate>sets the maximum motor force in N</translate>''<br/><!-- GIDEROSMTD:b2.PrismaticJoint:setMaxMotorForce(force) sets the maximum motor force in N -->
+
[[Special:MyLanguage/b2.PrismaticJoint:setMaxMotorForce|b2.PrismaticJoint:setMaxMotorForce]] ''sets the maximum motor force in N''<br/><!-- GIDEROSMTD:b2.PrismaticJoint:setMaxMotorForce(force) sets the maximum motor force in N -->
[[Special:MyLanguage/b2.PrismaticJoint:setMotorSpeed|b2.PrismaticJoint:setMotorSpeed]] ''<translate>sets the motor speed in meters per second</translate>''<br/><!-- GIDEROSMTD:b2.PrismaticJoint:setMotorSpeed(speed) sets the motor speed in meters per second -->
+
[[Special:MyLanguage/b2.PrismaticJoint:setMotorSpeed|b2.PrismaticJoint:setMotorSpeed]] ''sets the motor speed in meters per second''<br/><!-- GIDEROSMTD:b2.PrismaticJoint:setMotorSpeed(speed) sets the motor speed in meters per second -->
[[Special:MyLanguage/b2.RevoluteJoint:getMotorForce|b2.RevoluteJoint:getMotorForce]] ''<translate>returns the current motor force given the inverse time step</translate>''<br/><!-- GIDEROSMTD:b2.RevoluteJoint:getMotorForce(inv_dt) returns the current motor force given the inverse time step -->
+
[[Special:MyLanguage/b2.RevoluteJoint:getMotorForce|b2.RevoluteJoint:getMotorForce]] ''returns the current motor force given the inverse time step''<br/><!-- GIDEROSMTD:b2.RevoluteJoint:getMotorForce(inv_dt) returns the current motor force given the inverse time step -->
 +
 
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
=== <translate>Events</translate> ===
+
=== Events ===
=== <translate>Constants</translate> ===
+
=== Constants ===
 
|}
 
|}
 +
 +
----
 +
*'''[[LiquidFun]]'''

Revision as of 21:54, 17 February 2020


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

A prismatic joint. This joint provides one degree of freedom: translation along an axis fixed in body1. Relative rotation is prevented. You can use a joint limit to restrict the range of motion and a joint motor to drive the motion or to model joint friction.

Examples

Prismatic joint

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

--axisx, axisy values usually between 0 and 1
--0 0 moves freely
--0 1 moves on y axis
--1 0 moves on x axis
--1 1 moves on diagonal
local jointDef = b2.createPrismaticJointDef(body, ground, 350, 100, 0.3, 1)
local prismaticJoint = world:createJoint(jointDef)

Methods

b2.PrismaticJoint:enableLimit enables or disables the joint limit
b2.PrismaticJoint:enableMotor enables or disables the joint motor
b2.PrismaticJoint:getJointSpeed returns the current joint translation speed in meters per second
b2.PrismaticJoint:getJointTranslation returns the current joint translation in meters
b2.PrismaticJoint:getLimits returns the lower and upper joint limits in meters
b2.PrismaticJoint:getMotorSpeed returns the motor speed in meters per second
b2.PrismaticJoint:isLimitEnabled is the joint limit enabled?
b2.PrismaticJoint:isMotorEnabled is the joint motor enabled?
b2.PrismaticJoint:setLimits sets the joint limits in meters
b2.PrismaticJoint:setMaxMotorForce sets the maximum motor force in N
b2.PrismaticJoint:setMotorSpeed sets the motor speed in meters per second
b2.RevoluteJoint:getMotorForce returns the current motor force given the inverse time step

Events

Constants