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
colliderA
Collider
colliderB
Collider
disabled
Boolean
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.disabledOnce
Boolean
Disabled contact for current time step or sub-step.
Methods
getWorldManifold
Get the world manifold.getManifold
Get the manifold.getImpulse
Get the impulses. Note: PhysicsImpulse can only used in onPostSolve callback.isTouching
Is this contact touching?setTangentSpeed
Set the desired tangent speed for a conveyor belt behavior.getTangentSpeed
Get the desired tangent speed.setFriction
Override the default friction mixture. You can call this in onPreSolve callback.getFriction
Get the friction.resetFriction
Reset the friction mixture to the default value.setRestitution
Override the default restitution mixture. You can call this in onPreSolve callback.getRestitution
Get the restitution.resetRestitution
Reset 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
tangentSpeed
Number
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
friction
Number
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
restitution
Number
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 |