B2.PrismaticJoint

From GiderosMobile
Revision as of 14:20, 23 August 2018 by Hgy29 (talk | contribs)

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)

Methods

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

Events

Constants