Difference between revisions of "B2.PrismaticJoint"
From GiderosMobile
Line 22: | Line 22: | ||
| style="width: 50%;"| | | style="width: 50%;"| | ||
=== Methods === | === Methods === | ||
− | [[b2.PrismaticJoint:enableLimit]] | + | [[b2.PrismaticJoint:enableLimit]] {{<translate>enables or disables the joint limit</translate>}}<br/> |
− | [[b2.PrismaticJoint:enableMotor]] | + | [[b2.PrismaticJoint:enableMotor]] {{<translate>enables or disables the joint motor</translate>}}<br/> |
− | [[b2.PrismaticJoint:getJointSpeed]] | + | [[b2.PrismaticJoint:getJointSpeed]] {{<translate>returns the current joint translation speed in meters per second</translate>}}<br/> |
− | [[b2.PrismaticJoint:getJointTranslation]] | + | [[b2.PrismaticJoint:getJointTranslation]] {{<translate>returns the current joint translation in meters</translate>}}<br/> |
− | [[b2.PrismaticJoint:getLimits]] | + | [[b2.PrismaticJoint:getLimits]] {{<translate>returns the lower and upper joint limits in meters</translate>}}<br/> |
− | [[b2.PrismaticJoint:getMotorSpeed]] | + | [[b2.PrismaticJoint:getMotorSpeed]] {{<translate>returns the motor speed in meters per second</translate>}}<br/> |
− | [[b2.PrismaticJoint:isLimitEnabled]] | + | [[b2.PrismaticJoint:isLimitEnabled]] {{<translate>is the joint limit enabled?</translate>}}<br/> |
− | [[b2.PrismaticJoint:isMotorEnabled]] | + | [[b2.PrismaticJoint:isMotorEnabled]] {{<translate>is the joint motor enabled?</translate>}}<br/> |
− | [[b2.PrismaticJoint:setLimits]] | + | [[b2.PrismaticJoint:setLimits]] {{<translate>sets the joint limits in meters</translate>}}<br/> |
− | [[b2.PrismaticJoint:setMaxMotorForce]] | + | [[b2.PrismaticJoint:setMaxMotorForce]] {{<translate>sets the maximum motor force in N</translate>}}<br/> |
− | [[b2.PrismaticJoint:setMotorSpeed]] | + | [[b2.PrismaticJoint:setMotorSpeed]] {{<translate>sets the motor speed in meters per second</translate>}}<br/> |
− | [[b2.RevoluteJoint:getMotorForce]] | + | [[b2.RevoluteJoint:getMotorForce]] {{<translate>returns the current motor force given the inverse time step</translate>}}<br/> |
| style="width: 50%;"| | | style="width: 50%;"| | ||
=== Events === | === Events === | ||
=== Constants === | === Constants === | ||
|} | |} |
Revision as of 14:20, 23 August 2018
Supported platforms: android, ios, mac, pc
Available since: Gideros 2011.6
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)