PicoPicoGameEngine

Quick Links

物理エンジンオブジェクト

ピコピコゲームエンジンの物理シミュレーションエンジンはBox2Dです。
詳しくは Box2D のウェブページをご覧下さい。

b2World

.new()

ワールドオブジェクトのコンストラクター

world = b2World.new(x, y)
world = b2World.new({x, y})
world = b2World.new(gravity)
world : b2World object

ワールドオブジェクト

x,y : number

重力ベクトル

gravity : point object

重力ベクトル

w=b2World.new(0,20)

body=w:createBody(
  "dynamic",16,10)
shape=b2Shape.polygon()
shape:setAsBox(3,3)
body:createFixture(
  shape,{density=5})

body=w:createBody(
  "static",16,40)
shape=b2Shape.polygon()
shape:setAsBox(16,1)
body:createFixture(
  shape)

function start()
  w:debugDrag()
  w:step()
  w:debugDrawBody()
end
w=b2World.new(0,20)

sp1=ppsprite.new()
sp1:texture("sample.png")
sp1:tile(2)
sp1:scale(3,2)

body=w:createBody(
  "dynamic",16,10)
shape=b2Shape.polygon()
shape:setSprite(sp1)
body:createFixture(
  shape,{density=5})

sp2=ppsprite.new()
sp2:texture("sample.png")
sp2:tile(3)
sp2:scale(2,2)

body=w:createBody(
  "dynamic",16,20)
shape=b2Shape.circle()
shape:setSprite(sp2)
body:createFixture(
  shape,{density=5})

body=w:createBody(
  "static",16,40)
shape=b2Shape.polygon()
shape:setAsBox(16,1)
body:createFixture(
  shape)

function start()
  w:debugDrag()
  w:step()
  w:debugDrawBody()
  w:drawBody()
end

.allowSleep

world.allowSleep = sleep
sleep = world.allowSleep
world : b2World object
sleep : boolean

.wormStarting

world.wormStarting = wormStarting
wormStarting = world.wormStarting
world : b2World object
wormStarting : boolean

.continuousPhysics

world.continuousPhysics = cont
cont = world.continuousPhysics
world : b2World object
cont : boolean

.subStepping

world.subStepping = substep
substep = world.subStepping
world : b2World object
substep : boolean

.proxyCount

count = world.proxyCount
world : b2World object
count : number

.bodyCount

count = world.bodyCount
world : b2World object
count : number

.jointCount

count = world.jointCount
world : b2World object
count : number

.contactCount

count = world.contactCount
world : b2World object
count : number

.treeHeight

treeheight = world.treeHeight
world : b2World object
treeheight : number

.treeBalance

treebalance = world.treeBalance
world : b2World object
treebalance : number

.treeQuality

quality = world.treeQuality
world : b2World object
quality : number

.locked

islocked = world.locked
world : b2World object
islocked : boolean

.autoClearForces

world.autoClearForces = autoClear
autoClear = world.autoClearForces
world : b2World object
autoClear : boolean

:drawBody()

world:drawBody()
world:drawBody(body)
world:drawBody({body1, body2, ...})
world : b2World object
body : b2Body object
body1,body2,... : b2Body object

:drawShape()

world:drawShape(shape, transform)
world : b2World object
shape : b2Shape object
transform : b2Transform object

:debugDrawShape()

world:debugDrawShape(shape, transform)
world : b2World object
shape : b2Shape object
transform : b2Transform object

:debugDrawBody()

world:debugDrawBody()
world:debugDrawBody(body)
world:debugDrawBody({body1, body2, ...})
world : b2World object
body : b2Body object
body1,body2,... : b2Body object

:debugDrawJoint()

world:debugDrawJoint()
world : b2World object

:debugDrawAABB()

world:debugDrawAABB()
world : b2World object

:debugDrawCOMs()

world:debugDrawCOMs()
world : b2World object

:drawScale()

world:drawScale(x, y)
world:drawScale({x, y})
world:drawScale(scale)
scale=world:drawScale()
world : b2World object
x,y : number
scale : point object

:createBody()

body = world:createBody(x, y, [body_option])
body = world:createBody(body_type, x, y, [body_option])
world : b2World object
body : b2Body object
body_type : string
  • "static"
  • "dynamic"
  • "kinematic"
x,y : number
[body_option] : body option object

:destroyBody()

world:destroyBody(body)
world : b2World object
body : b2Body object

:createJoint()

joint = world:createJoint(joint_type, bodyA, bodyB, [option])
joint = world:createJoint(joint_def)
world : b2World object
joint : b2Joint object
joint_type : string
  • "distance"
  • "friction"
  • "gear"
  • "moter"
  • "mouse"
  • "prismatic"
  • "pulley"
  • "revolute"
  • "rope"
  • "weld"
  • "wheel"
bodyA : b2Body object
bodyB : b2Body object
[option] : joint option object
joint_def : b2JointDef object
w=b2World.new(0,10)

shape=b2Shape.edge()
shape:set(-40,0,40,0)
ground=w:createBody(16,40)
ground:createFixture(shape)

prevBody=ground

shape=b2Shape.polygon()
shape:setAsBox(0.5,2)
body=w:createBody(
  "dynamic",16,40-7)
body:createFixture(
  shape,{density=2})

joint1=w:createJoint(
  "revolute",
  prevBody,
  body,
  {
    anchor=pppoint(16,40-5),
    motorSpeed=1*math.pi,
    maxMotorTorque=10000,
    enableMotor=true
  })

prevBody=body

shape=b2Shape.polygon()
shape:setAsBox(0.5,4)
body=w:createBody(
  "dynamic",16,40-13)
body:createFixture(
  shape,{density=2})

w:createJoint(
  "revolute",
  prevBody,
  body,
  {
    anchor=pppoint(16,40-9),
    enableMotor=false
  })

prevBody=body

shape=b2Shape.polygon()
shape:setAsBox(1.5,1.5)

body=w:createBody(
  "dynamic",16,40-17,
  {fixedRotation=true})
body:createFixture(
  shape,{density=2})

w:createJoint(
  "revolute",
  prevBody,
  body,
  {
    anchor=pppoint(16,40-17),
  })

joint2=w:createJoint(
  "prismatic",
  ground,
  body,
  {
    anchor=pppoint(16,40-17),
    axis=pppoint(0,1),
    maxMotorForce=1000,
    enableMotor=true
  })

shape=b2Shape.polygon()
shape:setAsBox(1.5,1.5)
body=w:createBody(
  "dynamic",16,40-23)
body:createFixture(
  shape,{density=2})

function start()
  w:step(1.0/60,8,3)
  w:debugDrawBody()
  w:debugDrawJoint()
end
w=b2World.new(0,10)

b=w:createBody(16,40)
s=b2Shape.polygon()
s:setAsBox(16,0.5)
b:createFixture(s)

b=w:createBody(16,10)
s=b2Shape.polygon()
s:setAsBox(1,1)
b:createFixture(s)

body1=b

b=w:createBody(
  16,20,{type="dynamic"})
s=b2Shape.polygon()
s:setAsBox(1,1)
b:createFixture(s,{density=2})

body2=b

w:createJoint(
 "distance",body1,body2,
 {
    localAnchorA={0,0},
    localAnchorB={0,0},
    length=10
 })

b=w:createBody(
  16,30,{type="dynamic"})
s=b2Shape.polygon()
s:setAsBox(1,1)
b:createFixture(s,{density=2})

body3=b

j=b2Joint.distance(
 body2,body3,
 {
    localAnchorA={0,0},
    localAnchorB={0,0},
    length=10
 })
w:createJoint(j)

function start()
  w:step()
  w:debugDrag()
  w:debugDrawBody()
  w:debugDrawJoint()
end

:destroyJoint()

world:destroyJoint(joint)
world : b2World object
joint : b2Joint object

:step()

world:step([timeStep], [velocityIterations], [positionIterations])
world : b2World object
[timeStep] : number

Default 1/60

[velocityIterations] : number

Default 8

[positionIterations] : number

Default 3

:bodyList()

body = world:bodyList()
world : b2World object
body : b2Body object

:jointList()

joint = world:jointList()
world : b2World object
joint : b2Joint object

:gravity()

world:gravity(x, y)
world:gravity({x, y})
world:gravity(gravity)
gravity = world:gravity()
world : b2World object
x,y : number
gravity : point object

:getProfile()

profile = world:getProfile()
world : b2World object
profile : b2World profile object
{
  step=[number],
  collide=[number],
  solve=[number],
  solveInit=[number],
  solveVelocity=[number],
  solvePosition=[number],
  broadphase=[number],
  solveTOI=[number],
}

:queryAABB()

world:queryAABB(callback, x1, y1, x2, y2)
world:queryAABB(x1, y1, x2, y2, callback)
world:queryAABB(callback, {x1, y1}, {x2, y2})
world:queryAABB({x1, y1}, {x2, y2}, callback)
world:queryAABB(callback, p1, p2, )
world:queryAABB(p1, p2, callback)
world : b2World object
callback : queryAABB callback function
function(fixture)
  return [terminate_query:boolean]
end
x1,y1 : number
x2,y2 : number
p1,p2 : point object

:rayCast()

world:rayCast(x1, y1, x2, y2, callback)
world:rayCast(callback, x1, y1, x2, y2)
world:rayCast({x1, y1}, {x2, y2}, callback)
world:rayCast(callback, {x1, y1}, {x2, y2})
world:rayCast(p1, p2, callback)
world:rayCast(callback, p1, p2)
world : b2World object
x1,y1 : number
x2,y2 : number
p1,p2 : point object
callback : rayCast callback function
function(fixture)
  return [fraction:number]
end

:clearForces()

world:clearForces()
world : b2World object

:shiftOrigin()

world:shiftOrigin(x,y)
world : b2World object
x,y : number

:dump()

world:dump()
world : b2World object

b2Body

.type

type = body.type
body : b2Body object
type : number
  • b2Body.staticBody
  • b2Body.dynamicBody
  • b2Body.kinematicBody

.typename

typename = body.typename
body : b2Body object
typename : string
  • "static"
  • "dynamic"
  • "kinematic"

.x
.y

body.x = x
body.y = y

x = body.x
x = body.y
body : b2Body object
x,y : number

.angle

body.angle = angle
angle = body.angle
body : b2Body object
angle : number

.next

body = body.next
body : b2Body object

.angularVelocity

body.angularVelocity = velocity
velocity = body.angularVelocity
body : b2Body object
velocity : number

.mass

mass = body.mass
body : b2Body object
mass : number

.inertia

inertia = body.inertia
body : b2Body object
inertia : number

.linearDamping

body.linearDamping = linearDamping
linearDamping = body.linearDamping
body : b2Body object
linearDamping : number

.angularDamping

body.angularDamping = angularDamping
angularDamping = body.angularDamping
body : b2Body object
angularDamping : number

.gravityScale

body.gravityScale = gravityScale
gravityScale = body.gravityScale
body : b2Body object
gravityScale : number

.bullet

body.bullet = bullet
bullet = body.bullet
body : b2Body object
bullet : boolean

.allowSleep

body.allowSleep = allowSleep
allowSleep = body.allowSleep
body : b2Body object
allowSleep : boolean

.awake

body.awake = awake
awake = body.awake
body : b2Body object
awake : boolean

.active

body.active = active
active = body.active
body : b2Body object
active : boolean

.fixedRotation

body.fixedRotation = fixedRotation
fixedRotation = body.fixedRotation
body : b2Body object
fixedRotation : boolean

.world

world = body.world
body : b2Body object
world : b2World object

:createFixture()

fixture = body:createFixture(shape, [option])
body : b2Body object
fixture : b2Fixture object

:destroyFixture()

body:destroyFixture(fixture)
body : b2Body object
fixture : b2Fixture object

:transform()

body:transform(x, y, angle)
body:transform({x=x, y=y, angle=angle})
transform = body:transform()
body : b2Body object
transform : b2Transform object

:position()
:pos()

body:position(x,y)
body:pos(x,y)
body:position({x,y})
body:pos({x,y})
body:position(pos)
body:pos(pos)
pos = body:position()
pos = body:pos()
body : b2Body object
x : number
y : number
pos : point object

:move()

body:move(x,y)
body:move({x,y})
body:move(pos)
body : b2Body object
x : number
y : number
pos : point object

:worldCenter()

center = body:worldCenter()
body : b2Body object
center : point object

:localCenter()

center = body:localCenter()
body : b2Body object
center : point object

:applyForce()

body:applyForce(x,y, [awake])
body:applyForce({x,y}, [awake])
body:applyForce(vecter, [awake])
body : b2Body object
x : number
y : number
vecter : point object
[awake] : boolean/optional

:applyForceToCenter()

body:applyForceToCenter( x,y, [awake])
body:applyForceToCenter( {x,y}, [awake])
body:applyForceToCenter( force, [awake])
body : b2Body object
x : number
y : number
force : point object
[awake] : boolean/optional

:applyTorque()

body:applyTorque( torque, [wake])
body : b2Body object
torque : number
[awake] : boolean/optional

:applyLinearImpulse()

body:applyLinearImpulse(x,y, px,py, [awake])
body:applyLinearImpulse({x,y}, {px,py}, [awake])
body:applyLinearImpulse(impulse, point, [awake])
body : b2Body object
x : number
y : number
px : number
py : number
impulse : point object
point : point object
[awake] : boolean/optional

:applyAngularImpulse()

body:applyAngularImpulse(impulse, [awake])
body : b2Body object
impulse : number
[awake] : boolean/optional

:massData()

body:massData(mass)
mass = body:massData()
body : b2Body object
mass : mass data object
mass={
  mass=[number],
  center=[point object],
  I=[number],
  inertia=[number]
}

:resetMassData()

body:resetMassData()
body : b2Body object

:worldPoint()

pos = body:worldPoint(x,y)
pos = body:worldPoint({x,y})
pos = body:worldPoint(pos)
body : b2Body object
x : number
y : number
pos : point object

:worldVector()

vector = body:worldVector(x,y)
vector = body:worldVector({x,y})
vector = body:worldVector(vector)
body : b2Body object
x : number
y : number
vector : point object

:localPoint()

pos = body:localPoint(x,y)
pos = body:localPoint({x,y})
pos = body:localPoint(pos)
body : b2Body object
x : number
y : number
pos : point object

:localVector()

vector = body:localVector(x,y)
vector = body:localVector({x,y})
vector = body:localVector(vector)
body : b2Body object
x : number
y : number
vector : point object

:linearVelocity()

body:linearVelocity(x,y)
body:linearVelocity({x,y})
body:linearVelocity(vector)
vector = body:linearVelocity()
body : b2Body object
x : number
y : number
vector : point object

:linearVelocityFromWorldPoint()

velocity = body:linearVelocityFromWorldPoint(x,y)
velocity = body:linearVelocityFromWorldPoint({x,y})
velocity = body:linearVelocityFromWorldPoint(pos)
body : b2Body object
x : number
y : number
pos : point object
velocity : point object

:linearVelocityFromLocalPoint()

velocity = body:linearVelocityFromLocalPoint(x,y)
velocity = body:linearVelocityFromLocalPoint({x,y})
velocity = body:linearVelocityFromLocalPoint(pos)
body : b2Body object
x : number
y : number
pos : point object
velocity : point object

:isBullet()

bullet = body:isBullet()
body : b2Body object
bullet : boolean

:isSleepingAllowed()

sleep = body:isSleepingAllowed()
body : b2Body object
sleep : boolean

:isAwake()

awake = body:isAwake()
body : b2Body object
awake : boolean

:isActive()

active = body:isActive()
body : b2Body object
active : boolean

:isFixedRotation()

fixed = body:isFixedRotation()
body : b2Body object
fixed : boolean

:fixtureList()

fixture = body:fixtureList()
body : b2Body object
fixture : b2Fixture object

:testPoint()

hit = body:testPoint(x,y)
hit = body:testPoint({x,y})
hit = body:testPoint(pos)
body : b2Body object
x : number
y : number
pos : point object
hit : boolean

:dump()

body:dump()
body : b2Body object

.staticBody

type = b2Body.staticBody
type : number

.dynamicBody

type = b2Body.dynamicBody
type : number

.kinematicBody

type = b2Body.kinematicBody
type : number

b2Shape

.circle

shape = b2Shape.circle([option])
shape : b2CircleShape object
[option] : shape option object

.edge

shape = b2Shape.edge([option])
shape : b2EdgeShape object
[option] : shape option object

.polygon

shape = b2Shape.polygon([option])
shape : b2PolygonShape object
[option] : shape option object

.chain

shape = b2Shape.chain([option])
shape : b2ChainShape object
[option] : shape option object

.type

type = shape.type
shape : b2Shape object
type : number
  • b2Shape.chainShape
  • b2Shape.edgeShape
  • b2Shape.polygonShape
  • b2Shape.circleShape

.typename

typename = shape.typename
shape : b2Shape object
typename : string
  • "chain"
  • "edge"
  • "polygon"
  • "circle"

.childCount

count = shape.childCount
shape : b2Shape object
count : number

.radius

shape.radius = radius
radius = shape.radius
shape : b2Shape object
radius : number

:testPoint

hit = shape:testPoint(transform, point)
shape : b2Shape object
transform : b2Transform object
point : point object
hit : boolean

:rayCast

hit = shape:rayCast(x1, y1, x2, y2, transform)
hit = shape:rayCast({x1, y1}, {x2, y2}, transform)
hit = shape:rayCast(p1, p2, transform)
shape : b2Shape object
x1,y1 : number
x2,y2 : number
p1,p2 : point object
transform : b2Transform object
hit : boolean

:computeAABB

aabb = shape:computeAABB(transform, [index])
shape : b2Shape object
transform : b2Transform object
[index] : number
aabb : rectangle object

:computeMass

mass = shape:computeMass(density)
shape : b2Shape object
density : number
mass : mass data object
mass={
  mass=[number],
  center=[point object],
  I=[number],
  inertia=[number]
}

:setSprite()

shape:setSprite(sprite, [option])
shape : b2Shape object
sprite : ppsprite object
[option] : sprite shape option object

.circleShape

type = b2Shape.circleShape
type : number

.edgeShape

type = b2Shape.circleShape
type : number

.polygonShape

type = b2Shape.polygonShape
type : number

.chainShape

type = b2Shape.chainShape
type : number

b2ChainShape

b2Shapeのサブクラスです。

.vertices

vert_array = shape.vertices
shape : b2ChainShape object
vert_array : point object array

.count

count = shape.count
shape : b2ChainShape object
count : number

.prevVertex

shape.prevVertex = vertex
vertex = shape.prevVertex
shape : b2ChainShape object
vertex : point object

.nextVertex

shape.nextVertex = vertex
vertex = shape.nextVertex
shape : b2ChainShape object
vertex : point object

.hasPrevVertex

shape.hasPrevVertex = flag
flag = shape.hasPrevVertex
shape : b2ChainShape object
flag : boolean

.hasNextVertex

shape.hasNextVertex = flag
flag = shape.hasNextVertex
shape : b2ChainShape object
flag : boolean

.new

shape = b2ChainShape.new([option])
shape : b2ChainShape object
[option] : shape option object

:createLoop

shape:createLoop(x1, y1, x2, y2, ...)
shape:createLoop({x1, y1}, {x2, y2}, ...)
shape:createLoop(p1, p2, p3, ...)
shape : b2ChainShape object
x1 : number
y1 : number
x2 : number
y2 : number
p1,p2,p3,... : point object

:createChain

shape:createChain(x1, y1, x2, y2, ...)
shape:createChain({x1, y1}, {x2, y2}, ...)
shape:createChain(p1, p2, p3, ...)
shape : b2ChainShape object
x1 : number
y1 : number
x2 : number
y2 : number
p1,p2,p3,... : point object

:childEdge

edge = shape:childEdge(index)
shape : b2ChainShape object
edge : b2EdgeShape object

b2CircleShape

b2Shapeのサブクラスです。

.p

shape.p = center
center = shape.p
shape : b2CircleShape object
center : point object

.new

shape = b2CircleShape.new([option])
shape : b2CircleShape object
[option] : shape option object

:vertex

center = shape:vertex()
shape : b2CircleShape object
center : point object

b2EdgeShape

b2Shapeのサブクラスです。

.vertex1

shape.vertex1 = vertex
vertex = shape.vertex1
shape : b2EdgeShape object
vertex : point object

.vertex2

shape.vertex2 = vertex
vertex = shape.vertex2
shape : b2EdgeShape object
vertex : point object

.vertex0

shape.vertex0 = vertex
vertex = shape.vertex0
shape : b2EdgeShape object
vertex : point object

.vertex3

shape.vertex3 = vertex
vertex = shape.vertex3
shape : b2EdgeShape object
vertex : point object

.hasVertex0

shape.hasVertex0 = flag
flag = shape.hasVertex0
shape : b2EdgeShape object
flag : boolean

.hasVertex3

shape.hasVertex3 = flag
flag = shape.hasVertex3
shape : b2EdgeShape object
flag : boolean

.new

shape = b2EdgeShape.new([option])
shape : b2EdgeShape object
[option] : shape option object

:set

shape:set(x1, y1, x2, y2, ...)
shape:set({x1, y1}, {x2, y2}, ...)
shape:set(p1, p2)
x1 : number
y1 : number
x2 : number
y2 : number
p1,p2 : point object

b2PolygonShape

b2Shapeのサブクラスです。

.centroid

shape.centroid = center
center = shape.centroid
shape : b2PolygonShape object
center : point object

.vertices

vert_array = shape.vertices
shape : b2PolygonShape object
vert_array : point object array

.normals

normal_array = shape.normals
shape : b2PolygonShape object
normal_array : point object array

.count

count = shape.count
shape : b2PolygonShape object
count : number

.new

shape = b2PolygonShape.new([option])
shape : b2PolygonShape object
[option] : shape option object

:set()

shape:set(x1, y1, x2, y2, ...)
shape:set({x1, y1}, {x2, y2}, ...)
shape:set(p1, p2, p3, ...)
shape : b2PolygonShape object
x1,y1 : number
x2,y2 : number
p1,p2,p3,... : point object

:setAsBox()

shape:setAsBox(width,height)
shape:setAsBox({width,height})
shape:setAsBox(size)
shape : b2PolygonShape object
width,height : number
size : rectangle object

:vertex()

vertex = shape:vertex(index)
shape : b2PolygonShape object
vertex : point object
index : number

b2Joint

.distance()

joint_def = b2Joint.distance(bodyA, bodyB, [option])
bodyA : b2Body object
bodyB : b2Body object
[option] : joint option object
joint_def : b2JointDef object

.friction()

joint_def = b2Joint.friction(bodyA, bodyB, [option])
bodyA : b2Body object
bodyB : b2Body object
[option] : joint option object
joint_def : b2JointDef object

.gear()

joint_def = b2Joint.gear(bodyA, bodyB, [option])
bodyA : b2Body object
bodyB : b2Body object
[option] : joint option object
joint_def : b2JointDef object

.prismatic()

joint_def = b2Joint.prismatic(bodyA, bodyB, [option])
bodyA : b2Body object
bodyB : b2Body object
[option] : joint option object
joint_def : b2JointDef object

.pulley()

joint_def = b2Joint.pulley(bodyA, bodyB, [option])
bodyA : b2Body object
bodyB : b2Body object
[option] : joint option object
joint_def : b2JointDef object

.revolute()

joint_def = b2Joint.revolute(bodyA, bodyB, [option])
bodyA : b2Body object
bodyB : b2Body object
[option] : joint option object
joint_def : b2JointDef object

.rope()

joint_def = b2Joint.rope(bodyA, bodyB, [option])
bodyA : b2Body object
bodyB : b2Body object
[option] : joint option object
joint_def : b2JointDef object

.weld()

joint_def = b2Joint.weld(bodyA, bodyB, [option])
bodyA : b2Body object
bodyB : b2Body object
[option] : joint option object
joint_def : b2JointDef object

.wheel()

joint_def = b2Joint.wheel(bodyA, bodyB, [option])
bodyA : b2Body object
bodyB : b2Body object
[option] : joint option object
joint_def : b2JointDef object

.mouse()

joint_def = b2Joint.mouse(bodyA, bodyB, [option])
bodyA : b2Body object
bodyB : b2Body object
[option] : joint option object
joint_def : b2JointDef object

.type

type = joint.type
joint : b2Joint object
type : number
  • b2Joint.distanceJoint
  • b2Joint.frictionJoint
  • b2Joint.gearJoint
  • b2Joint.prismaticJoint
  • b2Joint.pulleyJoint
  • b2Joint.revoluteJoint
  • b2Joint.ropeJoint
  • b2Joint.weldJoint
  • b2Joint.wheelJoint
  • b2Joint.mouseJoint

.typename

typename = joint.typename
joint : b2Joint object
typename : string
  • "distance"
  • "friction"
  • "gear"
  • "prismatic"
  • "pulley"
  • "revolute"
  • "rope"
  • "weld"
  • "wheel"
  • "mouse"

.bodyA

body = joint.bodyA
joint : b2Joint object
body : b2Body object

.bodyB

body = joint.bodyB
joint : b2Joint object
body : b2Body object

.anchorA

anchor = joint.anchorA
joint : b2Joint object
anchor : point object

.anchorB

anchor = joint.anchorB
joint : b2Joint object
anchor : point object

.next

next_joint = joint.next
joint : b2Joint object
next_joint : b2Joint object

.active

active = joint.active
joint : b2Joint object
active : boolean

.collideConnected

collide = joint.collideConnected
joint : b2Joint object
collide : boolean

:reactionForce()

result = joint:reactionForce(inv_dt)
joint : b2Joint object
inv_dt : number
result : number

:reactionTorque()

result = joint:reactionTorque(inv_dt)
joint : b2Joint object
inv_dt : number
result : number

:isActive()

active = joint:isActive()
joint : b2Joint object
active : boolean

:dump()

joint:dump()
joint : b2Joint object

:shiftOrigin()

joint:shiftOrigin(x, y)
joint:shiftOrigin({x, y})
joint:shiftOrigin(point)
joint : b2Joint object
x,y : number
point : point object

.revoluteJoint

joint_type = b2Joint.revoluteJoint
joint : b2Joint object
joint_type : number

.prismaticJoint

joint_type = b2Joint.prismaticJoint
joint : b2Joint object
joint_type : number

.distanceJoint

joint_type = b2Joint.distanceJoint
joint : b2Joint object
joint_type : number

.pulleyJoint

joint_type = b2Joint.pulleyJoint
joint : b2Joint object
joint_type : number

.mouseJoint

joint_type = b2Joint.mouseJoint
joint : b2Joint object
joint_type : number

.gearJoint

joint_type = b2Joint.gearJoint
joint : b2Joint object
joint_type : number

.wheelJoint

joint_type = b2Joint.wheelJoint
joint : b2Joint object
joint_type : number

.weldJoint

joint_type = b2Joint.weldJoint
joint : b2Joint object
joint_type : number

.frictionJoint

joint_type = b2Joint.frictionJoint
joint : b2Joint object
joint_type : number

.ropeJoint

joint_type = b2Joint.ropeJoint
joint : b2Joint object
joint_type : number

.motorJoint

joint_type = b2Joint.motorJoint
joint : b2Joint object
joint_type : number

.inactiveLimit

const_value = b2Joint.inactiveLimit
joint : b2Joint object
const_value : number

.atLowerLimit

const_value = b2Joint.atLowerLimit
joint : b2Joint object
const_value : number

.atUpperLimit

const_value = b2Joint.atUpperLimit
joint : b2Joint object
const_value : number

.equalLimits

const_value = b2Joint.equalLimits
joint : b2Joint object
const_value : number

b2MoterJoint

b2Jointのサブクラスです。

.angularOffset

joint.angularOffset = offset
offset = joint.angularOffset
joint : b2MoterJoint object
offset : number

.maxForce

joint.maxForce = force
force = joint.maxForce
joint : b2MoterJoint object
force : number

.maxTorque

joint.maxTorque = torque
torque = joint.maxTorque
joint : b2MoterJoint object
torque : number

.correctionFactor

joint.correctionFactor = factor
factor = joint.correctionFactor
joint : b2MoterJoint object
factor : number

:linearOffset()

joint:linearOffset(offset)
offset = joint:linearOffset()
joint : b2MoterJoint object
offset : point object

b2DistanceJoint

b2Jointのサブクラスです。

.localAnchorA

anchor = joint.localAnchorA
joint : b2DistanceJoint object
anchor : point object

.localAnchorB

anchor = joint.localAnchorB
joint : b2DistanceJoint object
anchor : point object

.length

joint.length = length
length = joint.length
joint : b2DistanceJoint object
length : number

.frequency

joint.frequency = frequency
frequency = joint.frequency
joint : b2DistanceJoint object
frequency : number

.dampingRatio

joint.dampingRatio = ratio
ratio = joint.dampingRatio
joint : b2DistanceJoint object
ratio : number

b2FrictionJoint

b2Jointのサブクラスです。

.localAnchorA

anchor = joint.localAnchorA
joint : b2FrictionJoint object
anchor : point object

.localAnchorB

anchor = joint.localAnchorB
joint : b2FrictionJoint object
anchor : point object

.maxForce

joint.maxForce = force
force = joint.maxForce
joint : b2FrictionJoint object
force : number

.maxTorque

joint.maxTorque = torque
torque = joint.maxTorque
joint : b2FrictionJoint object
torque : number

b2GearJoint

b2Jointのサブクラスです。

.joint1

join1 = joint.joint1
joint : b2GearJoint object
join1 : b2Joint object

.joint2

joint2 = joint.joint2
joint : b2GearJoint object
joint2 : b2Joint object

.ratio

joint.ratio = ratio
ratio = joint.ratio
joint : b2GearJoint object
ratio : number

b2PrismaticJoint

b2Jointのサブクラスです。

.localAnchorA

anchor = joint.localAnchorA
joint : b2PrismaticJoint object
anchor : point object

.localAnchorB

anchor = joint.localAnchorB
joint : b2PrismaticJoint object
anchor : point object

.localAxisA

axis = joint.localAxisA
joint : b2PrismaticJoint object
axis : point object

.referenceAngle

angle = joint.referenceAngle
joint : b2PrismaticJoint object
angle : number

.jointTranslation

translation = joint.jointTranslation
joint : b2PrismaticJoint object
translation : number

.jointSpeed

speed = joint.jointSpeed
joint : b2PrismaticJoint object
speed : number

.enableLimit

joint.enableLimit = limit
limit = joint.enableLimit
joint : b2PrismaticJoint object
limit : boolean

.lowerLimit

limit = joint.lowerLimit
joint : b2PrismaticJoint object
limit : number

.upperLimit

limit = joint.upperLimit
joint : b2PrismaticJoint object
limit : number

.enableMotor

joint.enableMotor = flag
flag = joint.enableMotor
joint : b2PrismaticJoint object
flag : boolean

.motorSpeed

joint.motorSpeed = speed
speed = joint.motorSpeed
joint : b2PrismaticJoint object
speed : number

.maxMotorForce

joint.maxMotorForce = force
force = joint.maxMotorForce
joint : b2PrismaticJoint object
force : number

:isLimitEnabled()

flag = joint:isLimitEnabled()
joint : b2PrismaticJoint object
flag : boolean

:limits()

joint:limits(lower,upper)
joint : b2PrismaticJoint object
lower : number
upper : number

:isMotorEnabled()

flag = joint:isMotorEnabled()
joint : b2PrismaticJoint object
flag : boolean

:motorForce()

force = joint:motorForce(inv_dt)
joint : b2PrismaticJoint object
force : number

b2PulleyJoint

b2Jointのサブクラスです。

.groundAnchorA

anchor = joint.groundAnchorA
joint : b2PulleyJoint object
anchor : point object

.groundAnchorB

anchor = joint.groundAnchorB
joint : b2PulleyJoint object
anchor : point object

.lengthA

length = joint.lengthA
joint : b2PulleyJoint object
length : number

.lengthB

length = joint.lengthB
joint : b2PulleyJoint object
length : number

.ratio

joint.ratio = ratio
ratio = joint.ratio
joint : b2PulleyJoint object
ratio : number

.currentLengthA

length = joint.currentLengthA
joint : b2PulleyJoint object
length : number

.currentLengthB

length = joint.currentLengthB
joint : b2PulleyJoint object
length : number

b2RevoluteJoint

b2Jointのサブクラスです。

.localAnchorA

anchor = joint.localAnchorA
joint : b2RevoluteJoint object
anchor : point object

.localAnchorB

anchor = joint.localAnchorB
joint : b2RevoluteJoint object
anchor : point object

.referenceAngle

angle = joint.referenceAngle
joint : b2RevoluteJoint object
angle : number

.jointAngle

angle = joint.jointAngle
joint : b2RevoluteJoint object
angle : number

.jointSpeed

speed = joint.jointSpeed
joint : b2RevoluteJoint object
speed : number

.enableLimit

joint.enableLimit = flag
flag = joint.enableLimit
joint : b2RevoluteJoint object
flag : boolean

.lowerLimit

joint.lowerLimit = limit
limit = joint.lowerLimit
joint : b2RevoluteJoint object
limit : number

.upperLimit

joint.upperLimit = limit
limit = joint.upperLimit
joint : b2RevoluteJoint object
limit : number

.enableMotor

joint.enableMotor = flag
flag = joint.enableMotor
joint : b2RevoluteJoint object
flag : boolean

.motorSpeed

joint.motorSpeed = speed
speed = joint.motorSpeed
joint : b2RevoluteJoint object
speed : number

.maxMotorTorque

joint.maxMotorTorque = torque
torque = joint.maxMotorTorque
joint : b2RevoluteJoint object
torque : number

:isLimitEnabled()

flag = joint:isLimitEnabled()
joint : b2RevoluteJoint object
flag : boolean

:limits()

joint:limits(lower, upper)
joint : b2RevoluteJoint object
lower : number
upper : number

:isMotorEnabled()

flag = joint:isMotorEnabled()
joint : b2RevoluteJoint object
flag : boolean

:motorTorque()

torque = joint:motorTorque(inv_dt)
joint : b2RevoluteJoint object
inv_dt : number
torque : number

b2RopeJoint

b2Jointのサブクラスです。

.localAnchorA

anchor = joint.localAnchorA
joint : b2RopeJoint object
anchor : point object

.localAnchorB

anchor = joint.localAnchorB
joint : b2RopeJoint object
anchor : point object

.maxLength

joint.maxLength = length
length = joint.maxLength
joint : b2RopeJoint object
length : number

.limitState

state = joint.limitState
joint : b2RopeJoint object
state : number

b2WeldJoint

b2Jointのサブクラスです。

.localAnchorA

anchor = joint.localAnchorA
joint : b2WeldJoint object
anchor : point object

.localAnchorB

anchor = joint.localAnchorB
joint : b2WeldJoint object
anchor : point object

.referenceAngle

angle = joint.referenceAngle
joint : b2WeldJoint object
angle : number

.frequency

joint.frequency = frequency
frequency = joint.frequency
joint : b2WeldJoint object
frequency : number

.dampingRatio

joint.dampingRatio = ratio
ratio = joint.dampingRatio
joint : b2WeldJoint object
ratio : number

b2WheelJoint

b2Jointのサブクラスです。

.localAnchorA

anchor = joint.localAnchorA
joint : b2WheelJoint object
anchor : point object

.localAnchorB

anchor = joint.localAnchorB
joint : b2WheelJoint object
anchor : point object

.localAxisA

axis = joint.localAxisA
joint : b2WheelJoint object
axis : point object

.jointTranslation

joint.jointTranslation = translation
translation = joint.jointTranslation
joint : b2WheelJoint object
translation : number

.jointSpeed

joint.jointSpeed = speed
speed = joint.jointSpeed
joint : b2WheelJoint object
speed : number

.enableMotor

joint.enableMotor = flag
flag = joint.enableMotor
joint : b2WheelJoint object
flag : boolean

.motorSpeed

joint.motorSpeed = speed
speed = joint.motorSpeed
joint : b2WheelJoint object
speed : number

.maxMotorTorque

joint.maxMotorTorque = torque
torque = joint.maxMotorTorque
joint : b2WheelJoint object
torque : number

.springFrequencyHz

joint.springFrequencyHz = frequency
frequency = joint.springFrequencyHz
joint : b2WheelJoint object
frequency : number

.springDampingRatio

joint.springDampingRatio = ratio
ratio = joint.springDampingRatio
joint : b2WheelJoint object
ratio : number

:isMotorEnabled()

flag = joint:isMotorEnabled()
joint : b2WheelJoint object
flag : boolean

:motorTorque()

joint:motorTorque(torque)
torque = joint:motorTorque()
joint : b2WheelJoint object
torque : number

b2MouseJoint

b2Jointのサブクラスです。

.maxForce

joint.maxForce = force
force = joint.maxForce
joint : b2MouseJoint object
force : number

.frequency

joint.frequency = frequency
frequency = joint.frequency
joint : b2MouseJoint object
frequency : number

.dampingRatio

joint.dampingRatio = ratio
ratio = joint.dampingRatio
joint : b2MouseJoint object
ratio : number

:target()

joint:target(target)
target = joint:target()
joint : b2MouseJoint object
target : point object

:shiftOrigin()

joint:shiftOrigin(x, y)
joint:shiftOrigin({x, y})
joint:shiftOrigin(origin)
joint : b2MouseJoint object
x,y : number
origin : point object

b2Fixture

.type

type = fixture.type
fixture : b2Fixture object
type : number
  • b2Shape.circleShape
  • b2Shape.edgeShape
  • b2Shape.polygonShape
  • b2Shape.chainShape

.typename

typename = fixture.typename
fixture : b2Fixture object
typename : string
  • "circle"
  • "edge"
  • "polygon"
  • "chain"

.shape

shape = fixture.shape
fixture : b2Fixture object
shape : b2Shape object

.sensor

fixture.sensor = sensor
sensor = fixture.sensor
fixture : b2Fixture object
sensor : boolean

.body

body = fixture.body
fixture : b2Fixture object
body : b2Body object

.next

next_fixture = fixture.next
fixture : b2Fixture object
next_fixture : b2Fixture object

.density

fixture.density = density
density = fixture.density
fixture : b2Fixture object
density : number

.friction

fixture.friction = friction
friction = fixture.friction
fixture : b2Fixture object
friction : number

.restitution

fixture.restitution = restitution
restitution = fixture.restitution
fixture : b2Fixture object
restitution : number

.categoryBits

fixture.categoryBits = categoryBits
categoryBits = fixture.categoryBits
fixture : b2Fixture object
categoryBits : number

.maskBits

fixture.maskBits = maskBits
maskBits = fixture.maskBits
fixture : b2Fixture object
maskBits : number

.groupIndex

fixture.groupIndex = groupIndex
groupIndex = fixture.groupIndex
fixture : b2Fixture object
groupIndex : number

:isSensor()

sensor = fixture:isSensor()
fixture : b2Fixture object
sensor : boolean

:filterData()

fixture:filterData(data)
data = fixture:filterData()
fixture : b2Fixture object
data : filter data

:refilter()

fixture:refilter()
fixture : b2Fixture object

:testPoint()

hit = fixture:testPoint(point)
fixture : b2Fixture object
point : point object
hit : boolean

:rayCast()

output = fixture:rayCast({p1=p1, p2=p2, maxFraction=fraction}, childIndex)
fixture : b2Fixture object
p2,p2 : point object
fraction : number
childIndex : number
output : raycast output object

:massData()

mass = fixture:massData()
fixture : b2Fixture object
mass : mass data object
mass={
  mass=[number],
  center=[point object],
  I=[number],
  inertia=[number]
}

:AABB()

aabb = fixture:AABB()
fixture : b2Fixture object
aabb : rectangle object

:dump()

fixture:dump()
fixture : b2Fixture object

b2Contact

.touching

touch = contact.touching
contact : b2Contact object
touch : boolean

.enable

contact.enable = flag
flag = contact.enable
contact : b2Contact object
flag : boolean

.next

next_contact = contact.next
contact : b2Contact object
next_contact : b2Contact object

.fixtureA

fixture = contact.fixtureA
contact : b2Contact object
fixture : b2Fixture object

.childIndexA

index = contact.childIndexA
contact : b2Contact object
index : number

.fixtureB

fixture = contact.fixtureB
contact : b2Contact object
fixture : b2Fixture object

.childIndexB

index = contact.childIndexB
contact : b2Contact object
index : number

.friction

contact.friction = friction
friction = contact.friction
contact : b2Contact object
friction : number

.restitution

contact.restitution = restitution
restitution = contact.restitution
contact : b2Contact object
restitution : number

.tangentSpeed

contact.tangentSpeed = speed
speed = contact.tangentSpeed
contact : b2Contact object
speed : number

:isEnabled

flag = contact:isEnabled()
contact : b2Contact object
flag : boolean

:resetFriction

contact:resetFriction()
contact : b2Contact object

:resetRestitution

contact:resetRestitution()
contact : b2Contact object

b2Transform

.new

t = b2Transform.new(x, y, angle)
t = b2Transform.new({x, y}, angle)
t = b2Transform.new({x, y, angle})
t = b2Transform.new(point, angle)
t : b2Transform object
x,y : number
angle : number
point : point object

:identity()

t:identity()
t : b2Transform object

:set()

t:set(x, y, angle)
t:set({x, y}, angle)
t:set({x, y, angle})
t:set(point, angle)
t : b2Transform object
x,y : number
angle : number

b2Settings

.maxManifoldPoints

const_value = b2Settings.maxManifoldPoints
const_value : number

.maxPolygonVertices

const_value = b2Settings.maxPolygonVertices
const_value : number

.aabbExtension

const_value = b2Settings.aabbExtension
const_value : number

.abbMultiplier

const_value = b2Settings.abbMultiplier
const_value : number

.linearSlop

const_value = b2Settings.linearSlop
const_value : number

.angularSlop

const_value = b2Settings.angularSlop
const_value : number

.polygonRadius

const_value = b2Settings.polygonRadius
const_value : number

.maxSubSteps

const_value = b2Settings.maxSubSteps
const_value : number

.maxTOIContacts

const_value = b2Settings.maxTOIContacts
const_value : number

.velocityThreshold

const_value = b2Settings.velocityThreshold
const_value : number

.maxLinearCorrection

const_value = b2Settings.maxLinearCorrection
const_value : number

.maxAngularCorrection

const_value = b2Settings.maxAngularCorrection
const_value : number

.maxTranslation

const_value = b2Settings.maxTranslation
const_value : number

.maxTranslationSquared

const_value = b2Settings.maxTranslationSquared
const_value : number

.maxRotation

const_value = b2Settings.maxRotation
const_value : number

.maxRotationSquared

const_value = b2Settings.maxRotationSquared
const_value : number

.baumgarte

const_value = b2Settings.baumgarte
const_value : number

.toiBaugarte

const_value = b2Settings.toiBaugarte
const_value : number

.timeToSleep

const_value = b2Settings.timeToSleep
const_value : number

.linearSleepTolerance

const_value = b2Settings.linearSleepTolerance
const_value : number

.angularSleepTolerance

const_value = b2Settings.angularSleepTolerance
const_value : number