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.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.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.getFriction
Get the friction.resetFriction
Reset the friction mixture to the default value.setRestitution
Override the default restitution mixture.getRestitution
Get the restitution.resetRestitution
Reset the restitution mixture to the default value.
Details
Properties
colliderA
meta | description |
---|---|
Type | Collider |
Defined in | cocos2d/core/physics/CCPhysicsContact.js:423 |
colliderB
meta | description |
---|---|
Type | Collider |
Defined in | cocos2d/core/physics/CCPhysicsContact.js:426 |
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 | cocos2d/core/physics/CCPhysicsContact.js:429 |
disabledOnce
Disabled contact for current time step or sub-step.
meta | description |
---|---|
Type | Boolean |
Defined in | cocos2d/core/physics/CCPhysicsContact.js:438 |
Methods
getWorldManifold
Get the world manifold.
meta | description |
---|---|
Returns | WorldManifold |
Defined in | cocos2d/core/physics/CCPhysicsContact.js:236 |
getManifold
Get the manifold.
meta | description |
---|---|
Returns | Manifold |
Defined in | cocos2d/core/physics/CCPhysicsContact.js:276 |
getImpulse
Get the impulses. Note: PhysicsImpulse can only used in onPostSolve callback.
meta | description |
---|---|
Returns | PhysicsImpulse |
Defined in | cocos2d/core/physics/CCPhysicsContact.js:318 |
isTouching
Is this contact touching?
meta | description |
---|---|
Returns | Boolean |
Defined in | cocos2d/core/physics/CCPhysicsContact.js:449 |
setTangentSpeed
Set the desired tangent speed for a conveyor belt behavior.
meta | description |
---|---|
Defined in | cocos2d/core/physics/CCPhysicsContact.js:461 |
Parameters
tangentSpeed
Number
getTangentSpeed
Get the desired tangent speed.
meta | description |
---|---|
Returns | Number |
Defined in | cocos2d/core/physics/CCPhysicsContact.js:472 |
setFriction
Override the default friction mixture. You can call this in onPreSolve callback.
meta | description |
---|---|
Defined in | cocos2d/core/physics/CCPhysicsContact.js:485 |
Parameters
friction
Number
getFriction
Get the friction.
meta | description |
---|---|
Returns | Number |
Defined in | cocos2d/core/physics/CCPhysicsContact.js:496 |
resetFriction
Reset the friction mixture to the default value.
meta | description |
---|---|
Defined in | cocos2d/core/physics/CCPhysicsContact.js:507 |
setRestitution
Override the default restitution mixture. You can call this in onPreSolve callback.
meta | description |
---|---|
Defined in | cocos2d/core/physics/CCPhysicsContact.js:517 |
Parameters
restitution
Number
getRestitution
Get the restitution.
meta | description |
---|---|
Returns | Number |
Defined in | cocos2d/core/physics/CCPhysicsContact.js:528 |
resetRestitution
Reset the restitution mixture to the default value.
meta | description |
---|---|
Defined in | cocos2d/core/physics/CCPhysicsContact.js:539 |