API Docs for: 0.7.0
Show:

ContactMaterial Class

Defines what happens when two materials meet, such as what friction coefficient to use. You can also set other things such as restitution, surface velocity and constraint parameters.

Constructor

ContactMaterial

(
  • materialA
  • materialB
  • [options]
)

Parameters:

  • materialA Material
  • materialB Material
  • [options] Object optional
    • [friction=0.3] Number optional

      Friction coefficient.

    • [restitution=0] Number optional

      Restitution coefficient aka "bounciness".

    • [stiffness] Number optional

      ContactEquation stiffness.

    • [relaxation] Number optional

      ContactEquation relaxation.

    • [frictionStiffness] Number optional

      FrictionEquation stiffness.

    • [frictionRelaxation] Number optional

      FrictionEquation relaxation.

    • [surfaceVelocity=0] Number optional

      Surface velocity.

Properties

contactSkinSize

Number

Offset to be set on ContactEquations. A positive value will make the bodies penetrate more into each other. Can be useful in scenes where contacts need to be more persistent, for example when stacking. Aka "cure for nervous contacts".

friction

Number

Friction to use in the contact of these two materials

frictionRelaxation

Number

Relaxation of the resulting FrictionEquation that this ContactMaterial generate

frictionStiffness

Number

Stiffness of the resulting FrictionEquation that this ContactMaterial generate

id

Number

The contact material identifier

materialA

Material

First material participating in the contact material

materialB

Material

Second material participating in the contact material

relaxation

Number

Relaxation of the resulting ContactEquation that this ContactMaterial generate

restitution

Number

Restitution to use in the contact of these two materials

stiffness

Number

Stiffness of the resulting ContactEquation that this ContactMaterial generate

surfaceVelocity

Number

Will add surface velocity to this material. If bodyA rests on top if bodyB, and the surface velocity is positive, bodyA will slide to the right.