PhysicsPolygonCollider 类型
继承于 PhysicsCollider, Collider.Polygon(mixin)
索引
属性(properties)
offsetVec2位置偏移量pointsVec2[]多边形顶点数组densityNumber密度sensorBoolean一个传感器类型的碰撞体会产生碰撞回调,但是不会发生物理碰撞效果。frictionNumber摩擦系数,取值一般在 [0, 1] 之间restitutionNumber弹性系数,取值一般在 [0, 1]之间bodyRigidBody碰撞体会在初始化时查找节点上是否存在刚体,如果查找成功则赋值到这个属性上。
方法
Details
属性(properties)
offset
位置偏移量
| meta | description |
|---|---|
| 类型 | Vec2 |
| 定义于 | cocos2d/core/collider/CCPolygonCollider.js:45 |
points
多边形顶点数组
| meta | description |
|---|---|
| 类型 | Vec2[] |
| 定义于 | cocos2d/core/collider/CCPolygonCollider.js:61 |
density
密度
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/physics/collider/CCPhysicsCollider.js:53 |
sensor
一个传感器类型的碰撞体会产生碰撞回调,但是不会发生物理碰撞效果。
| meta | description |
|---|---|
| 类型 | Boolean |
| 定义于 | cocos2d/core/physics/collider/CCPhysicsCollider.js:71 |
friction
摩擦系数,取值一般在 [0, 1] 之间
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/physics/collider/CCPhysicsCollider.js:89 |
restitution
弹性系数,取值一般在 [0, 1]之间
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/physics/collider/CCPhysicsCollider.js:107 |
body
碰撞体会在初始化时查找节点上是否存在刚体,如果查找成功则赋值到这个属性上。
| meta | description |
|---|---|
| 类型 | RigidBody |
| 定义于 | cocos2d/core/physics/collider/CCPhysicsCollider.js:125 |
方法
apply
应用当前 collider 中的修改,调用此函数会重新生成内部 box2d 的夹具。
| meta | description |
|---|---|
| 定义于 | cocos2d/core/physics/collider/CCPhysicsCollider.js:257 |
getAABB
获取碰撞体的世界坐标系下的包围盒
| meta | description |
|---|---|
| 定义于 | cocos2d/core/physics/collider/CCPhysicsCollider.js:269 |