Difference between revisions of "B2.PrismaticJoint"
m (Text replacement - "<source" to "<syntaxhighlight") |
m (Text replacement - "</source" to "</syntaxhighlight") |
||
Line 23: | Line 23: | ||
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) | local prismaticJoint = world:createJoint(jointDef) | ||
− | </ | + | </syntaxhighlight> |
{|- | {|- |
Latest revision as of 16:54, 12 July 2023
Supported platforms:
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)
Methodsb2.PrismaticJoint:enableLimit enables or disables the joint limit |
EventsConstants |