PolyShape

cp. PolyShape

new PolyShape(body, verts, offset)

Source:
Initialize a polygon shape. The vertexes must be convex and have a clockwise winding.
Parameters:
Name Type Description
body cp.Body
verts Array.<number>
offset cp.Vect

Extends

Members

(static, constant) PolyShape#collisionCode :number

Source:
Type:
  • number

(static, constant) PolyShape#collisionTable :Array.<function()>

Source:
Type:
  • Array.<function()>

Methods

active() → {boolean}

Source:
Inherited From:
Returns:
Type
boolean

cacheBB()

Source:
Inherited From:
Returns:

cacheData(p, rot)

Source:
Parameters:
Name Type Description
p cp.Vect
rot cp.Vect

containsVert(vx, vy) → {boolean}

Source:
Parameters:
Name Type Description
vx number
vy number
Returns:
Type
boolean

containsVertPartial(vx, vy, n) → {boolean}

Source:
Parameters:
Name Type Description
vx number
vy number
n cp.Vect
Returns:
Type
boolean

getBB() → {cp.BB}

Source:
Inherited From:
Returns:
Type
cp.BB

getBody() → {cp.Body}

Source:
Inherited From:
Returns:
Type
cp.Body

getNumVerts() → {number}

Source:
Returns:
Type
number

getVert(i) → {cp.Vect}

Source:
Parameters:
Name Type Description
i number
Returns:
Type
cp.Vect

nearestPointQuery(p) → {NearestPointQueryInfo}

Source:
Parameters:
Name Type Description
p cp.Vect
Returns:
Type
NearestPointQueryInfo

pointQuery(p) → {NearestPointQueryInfo}

Source:
Inherited From:
Parameters:
Name Type Description
p cp.Vect
Returns:
Type
NearestPointQueryInfo

segmentQuery(a, b) → {SegmentQueryInfo}

Source:
Parameters:
Name Type Description
a cp.Vect
b cp.Vect
Returns:
Type
SegmentQueryInfo

setBody(body)

Source:
Inherited From:
Parameters:
Name Type Description
body cp.Body

setCollisionType(collision_type)

Source:
Inherited From:
Parameters:
Name Type Description
collision_type number

setElasticity(e)

Source:
Inherited From:
Parameters:
Name Type Description
e number How bouncy this shape is.

setFriction(u)

Source:
Inherited From:
Parameters:
Name Type Description
u number How much friction this shape has.

setLayers(layers)

Source:
Inherited From:
Parameters:
Name Type Description
layers number

setSensor(sensor)

Source:
Inherited From:
Parameters:
Name Type Description
sensor boolean

setVerts(verts, offset)

Source:
Parameters:
Name Type Description
verts Array.<number>
offset cp.Vect

transformAxes(p, rot)

Source:
Parameters:
Name Type Description
p cp.Vect
rot cp.Vect

transformVerts(p, rot)

Source:
Parameters:
Name Type Description
p cp.Vect
rot cp.Vect

update(pos, rot)

Source:
Inherited From:
Parameters:
Name Type Description
pos cp.Vect
rot cp.Vect

valueOnAxis(n, d)

Source:
Parameters:
Name Type Description
n cp.Vect
d number