Hierarchy
The ʹ Collider2D co ʹparameter is the Collider that the player collided with from INFORMATIO ICTNW516 at Western University. Unity’s Collider2D, Detecting Collisions Now that Game Objects has physical body representation, the physics engine needs a way to detects collisions between these bodies. This can be made using 2D Colliders.
- any
- Collider2D
Index
Properties
Accessors
Methods
Properties
Readonly TYPE
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:126
Protected _body
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:190
Protected _density
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:195
Protected _friction
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:199
Protected _group
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:193
Protected _offset
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:203
Protected _restitution
Collider2d
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:201
Protected _sensor
Collider2d Distance
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:197
Protected _shape
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:189
editing
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:22
tag
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:28
Tag. If a node has several collider components, you can judge which type of collider is collided according to the tag.
Accessors
body
- get body(): null | RigidBody2D
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:118
Physics collider will find the rigidbody component on the node and set to this property.
Returns null | RigidBody2D
density
- get density(): number
- set density(v: number): void
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:52
Returns number
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:55
Parameters
v: number
Returns void
friction
- get friction(): number
- set friction(v: number): void
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:80
The friction coefficient, usually in the range [0,1].
Returns number
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:83
The friction coefficient, usually in the range [0,1].
Parameters
v: number
Returns void
group
- get group(): number
- set group(v: number): void
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:37
Returns number
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:40
Parameters
v: number
Returns void
impl
- get impl(): null | IBaseShape
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:122
Returns null | IBaseShape
offset
- get offset(): Vec2
- set offset(v: Vec2): void
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:105
Returns Vec2
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:108
Parameters
v: Vec2
Returns void
restitution
- get restitution(): number
- set restitution(v: number): void
Unity Edge Collider 2d
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:94
The restitution (elasticity) usually in the range [0,1].
Returns number
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:97
The restitution (elasticity) usually in the range [0,1].
Parameters
v: number
Returns void
sensor
- get sensor(): boolean
- set sensor(v: boolean): void
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:66
A sensor collider collects contact information but never generates a collision response
Returns boolean
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:69
A sensor collider collects contact information but never generates a collision response
Parameters
v: boolean
Returns void
worldAABB
- get worldAABB(): Readonly<Rect>
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:179
Returns Readonly<Rect>
Methods
apply
- apply(): void
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:167
If the physics engine is box2d, need to call this function to apply current changes to collider, this will regenerate inner box2d fixtures.
Returns void
Protected onDestroy
- onDestroy(): void
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:155
Returns void
Protected onDisable
- onDisable(): void
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:149
Returns void
Protected onEnable
- onEnable(): void
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:143
Returns void
Protected onLoad
- onLoad(): void
- Defined in cocos/physics-2d/framework/components/colliders/collider-2d.ts:130
Returns void