PhysicsPolygonCollider Class
Extends PhysicsCollider
Index
Properties
- offset- Vec2Position offset
- points- [Vec2]Polygon points
- density- NumberThe density.
- sensor- BooleanA sensor collider collects contact information but never generates a collision response
- friction- NumberThe friction coefficient, usually in the range [0,1].
- restitution- NumberThe restitution (elasticity) usually in the range [0,1].
- body- RigidBodyPhysics collider will find the rigidbody component on the node and set to this property.
Methods
- applyApply current changes to collider, this will regenerate inner box2d fixtures.
- getAABBGet the world aabb of the collider
Details
Properties
offset
Position offset
| meta | description | 
|---|---|
| Type | Vec2 | 
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/collider/CCPolygonCollider.js:44 | 
points
Polygon points
| meta | description | 
|---|---|
| Type | [Vec2] | 
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/collider/CCPolygonCollider.js:60 | 
density
The density.
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/physics/collider/CCPhysicsCollider.js:52 | 
sensor
A sensor collider collects contact information but never generates a collision response
| meta | description | 
|---|---|
| Type | Boolean | 
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/physics/collider/CCPhysicsCollider.js:70 | 
friction
The friction coefficient, usually in the range [0,1].
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/physics/collider/CCPhysicsCollider.js:88 | 
restitution
The restitution (elasticity) usually in the range [0,1].
| meta | description | 
|---|---|
| Type | Number | 
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/physics/collider/CCPhysicsCollider.js:106 | 
body
Physics collider will find the rigidbody component on the node and set to this property.
| meta | description | 
|---|---|
| Type | RigidBody | 
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/physics/collider/CCPhysicsCollider.js:124 | 
Methods
apply
Apply current changes to collider, this will regenerate inner box2d fixtures.
| meta | description | 
|---|---|
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/physics/collider/CCPhysicsCollider.js:256 | 
getAABB
Get the world aabb of the collider
| meta | description | 
|---|---|
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/physics/collider/CCPhysicsCollider.js:268 | 
