PhysicsContact
Class
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:478 |
colliderB
meta | description |
---|---|
Type | Collider |
Defined in | cocos2d/core/physics/CCPhysicsContact.js:481 |
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:484 |
disabledOnce
Disabled contact for current time step or sub-step.
meta | description |
---|---|
Type | Boolean |
Defined in | cocos2d/core/physics/CCPhysicsContact.js:493 |
Methods
getWorldManifold
Get the world manifold.
meta | description |
---|---|
Returns | WorldManifold |
Defined in | cocos2d/core/physics/CCPhysicsContact.js:238 |
getManifold
Get the manifold.
meta | description |
---|---|
Returns | Manifold |
Defined in | cocos2d/core/physics/CCPhysicsContact.js:298 |
getImpulse
Get the impulses. Note: PhysicsImpulse can only used in onPostSolve callback.
meta | description |
---|---|
Returns | PhysicsImpulse |
Defined in | cocos2d/core/physics/CCPhysicsContact.js:362 |
isTouching
Is this contact touching?
meta | description |
---|---|
Returns | Boolean |
Defined in | cocos2d/core/physics/CCPhysicsContact.js:504 |
setTangentSpeed
Set the desired tangent speed for a conveyor belt behavior.
meta | description |
---|---|
Defined in | cocos2d/core/physics/CCPhysicsContact.js:516 |
Parameters
tangentSpeed
Number
getTangentSpeed
Get the desired tangent speed.
meta | description |
---|---|
Returns | Number |
Defined in | cocos2d/core/physics/CCPhysicsContact.js:527 |
setFriction
Override the default friction mixture. You can call this in onPreSolve callback.
meta | description |
---|---|
Defined in | cocos2d/core/physics/CCPhysicsContact.js:540 |
Parameters
friction
Number
getFriction
Get the friction.
meta | description |
---|---|
Returns | Number |
Defined in | cocos2d/core/physics/CCPhysicsContact.js:551 |
resetFriction
Reset the friction mixture to the default value.
meta | description |
---|---|
Defined in | cocos2d/core/physics/CCPhysicsContact.js:562 |
setRestitution
Override the default restitution mixture. You can call this in onPreSolve callback.
meta | description |
---|---|
Defined in | cocos2d/core/physics/CCPhysicsContact.js:572 |
Parameters
restitution
Number
getRestitution
Get the restitution.
meta | description |
---|---|
Returns | Number |
Defined in | cocos2d/core/physics/CCPhysicsContact.js:583 |
resetRestitution
Reset the restitution mixture to the default value.
meta | description |
---|---|
Defined in | cocos2d/core/physics/CCPhysicsContact.js:594 |