PhysicsContact Class
Module: cc
PhysicsContact will be generated during begin and end collision as a parameter of the collision callback. Note that contacts will be reused for speed up cpu time, so do not cache anything in the contact.
Index
Properties
colliderACollidercolliderBColliderdisabledBooleanIf set disabled to true, the contact will be ignored until contact end. If you just want to disabled contact for current time step or sub-step, please use disabledOnce.disabledOnceBooleanDisabled contact for current time step or sub-step.
Methods
getWorldManifoldGet the world manifold.getManifoldGet the manifold.getImpulseGet the impulses. Note: PhysicsImpulse can only used in onPostSolve callback.isTouchingIs this contact touching?setTangentSpeedSet the desired tangent speed for a conveyor belt behavior.getTangentSpeedGet the desired tangent speed.setFrictionOverride the default friction mixture. You can call this in onPreSolve callback.getFrictionGet the friction.resetFrictionReset the friction mixture to the default value.setRestitutionOverride the default restitution mixture. You can call this in onPreSolve callback.getRestitutionGet the restitution.resetRestitutionReset the restitution mixture to the default value.
Details
Properties
colliderA
| meta | description |
|---|---|
| Type | Collider |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/physics/CCPhysicsContact.js:453 |
colliderB
| meta | description |
|---|---|
| Type | Collider |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/physics/CCPhysicsContact.js:456 |
disabled
If set disabled to true, the contact will be ignored until contact end. If you just want to disabled contact for current time step or sub-step, please use disabledOnce.
| meta | description |
|---|---|
| Type | Boolean |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/physics/CCPhysicsContact.js:459 |
disabledOnce
Disabled contact for current time step or sub-step.
| meta | description |
|---|---|
| Type | Boolean |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/physics/CCPhysicsContact.js:468 |
Methods
getWorldManifold
Get the world manifold.
| meta | description |
|---|---|
| Returns | WorldManifold |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/physics/CCPhysicsContact.js:213 |
getManifold
Get the manifold.
| meta | description |
|---|---|
| Returns | Manifold |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/physics/CCPhysicsContact.js:273 |
getImpulse
Get the impulses. Note: PhysicsImpulse can only used in onPostSolve callback.
| meta | description |
|---|---|
| Returns | PhysicsImpulse |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/physics/CCPhysicsContact.js:337 |
isTouching
Is this contact touching?
| meta | description |
|---|---|
| Returns | Boolean |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/physics/CCPhysicsContact.js:479 |
setTangentSpeed
Set the desired tangent speed for a conveyor belt behavior.
| meta | description |
|---|---|
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/physics/CCPhysicsContact.js:491 |
Parameters
tangentSpeedNumber
getTangentSpeed
Get the desired tangent speed.
| meta | description |
|---|---|
| Returns | Number |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/physics/CCPhysicsContact.js:502 |
setFriction
Override the default friction mixture. You can call this in onPreSolve callback.
| meta | description |
|---|---|
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/physics/CCPhysicsContact.js:515 |
Parameters
frictionNumber
getFriction
Get the friction.
| meta | description |
|---|---|
| Returns | Number |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/physics/CCPhysicsContact.js:526 |
resetFriction
Reset the friction mixture to the default value.
| meta | description |
|---|---|
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/physics/CCPhysicsContact.js:537 |
setRestitution
Override the default restitution mixture. You can call this in onPreSolve callback.
| meta | description |
|---|---|
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/physics/CCPhysicsContact.js:547 |
Parameters
restitutionNumber
getRestitution
Get the restitution.
| meta | description |
|---|---|
| Returns | Number |
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/physics/CCPhysicsContact.js:558 |
resetRestitution
Reset the restitution mixture to the default value.
| meta | description |
|---|---|
| Defined in | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/physics/CCPhysicsContact.js:569 |