SegmentShape

cp. SegmentShape

new SegmentShape(body, a, b, r)

Source:
A beveled (rounded) segment shape.
Parameters:
Name Type Description
body cp.Body
a cp.Vect The start of the segment shape.
b cp.Vect The end of the segment shape.
r number The beveling radius of the segment shape.

Extends

Members

(static, constant) SegmentShape#collisionCode :number

Source:
Type:
  • number

(static, constant) SegmentShape#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

getBB() → {cp.BB}

Source:
Inherited From:
Returns:
Type
cp.BB

getBody() → {cp.Body}

Source:
Inherited From:
Returns:
Type
cp.Body

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.

setEndpoints(a, b)

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

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

setNeighbors(prev, next)

Source:
Parameters:
Name Type Description
prev cp.Vect
next cp.Vect

setSensor(sensor)

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

update(pos, rot)

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