new Shape(body)
- Source:
The cpShape struct defines the shape of a rigid body.
Opaque collision shape struct. Do not create directly - instead use
PolyShape, CircleShape and SegmentShape.
Parameters:
Name | Type | Description |
---|---|---|
body |
cp.Body |
Methods
active() → {boolean}
- Source:
Returns:
- Type
- boolean
cacheBB()
- Source:
Returns:
getBB() → {cp.BB}
- Source:
Returns:
- Type
- cp.BB
getBody() → {cp.Body}
- Source:
Returns:
- Type
- cp.Body
pointQuery(p) → {NearestPointQueryInfo}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
p |
cp.Vect |
Returns:
setBody(body)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
body |
cp.Body |
setCollisionType(collision_type)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
collision_type |
number |
setElasticity(e)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
e |
number | How bouncy this shape is. |
setFriction(u)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
u |
number | How much friction this shape has. |
setLayers(layers)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
layers |
number |
setSensor(sensor)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
sensor |
boolean |
update(pos, rot)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
pos |
cp.Vect | |
rot |
cp.Vect |