Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


PhysicsMaterialCombine2D

Describes how PhysicsMaterial2D friction and bounciness are combined when two Collider2D come into contact.
Read time 1 minuteLast updated 6 days ago

Definition

  • Type: Enum
  • Namespace: UnityEngine
  • Assembly: UnityEngine.Physics2DModule
public enum PhysicsMaterialCombine2D

Remarks

When two Collider2D come into contact, each might has its own PhysicsMaterial2D assigned, and each with its own PhysicsMaterial2D.friction and PhysicsMaterial2D.bounciness. To calculate the collision response, both friction and bounciness values must be combined using the PhysicsMaterialCombine2D provides multiple algorithms.
Note: Each Collider2D can have a unique PhysicsMaterial2D with different combine modes for friction and bounciness. When different modes are set, the mode with the highest priority is used in this order: PhysicsMaterialCombine2D.Maximum, PhysicsMaterialCombine2D.Minimum, PhysicsMaterialCombine2D.Multiply, PhysicsMaterialCombine2D.Mean, and PhysicsMaterialCombine2D.Average. For example, if one PhysicsMaterial2D uses PhysicsMaterialCombine2D.Average while the other uses PhysicsMaterialCombine2D.Maximum, the PhysicsMaterialCombine2D.Maximum combine function is used because it has higher priority.

Fields

Value

Description

AverageUses an Average algorithm when combining friction or bounciness.
MaximumUses a Maximum algorithm when combining friction or bounciness i.e. the maximum of the two values is used.
MeanUses a Geomtric Mean algorithm when combining friction or bounciness.
MinimumUses a Minimum algorithm when combining friction or bounciness i.e. the minimum of the two values is used.
MultiplyUses a Multiply algorithm when combining friction or bounciness i.e. the product of the two values is used.