Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Chain definition reference for the Physics Core 2D API

Explore the properties you can use to configure a physics chain in the Editor.
Read time 4 minutesLast updated 13 days ago

Note
This documentation is about writing C# scripts using the
Unity.U2D.Physics
API. To use 2D physics in the Unity Editor using components like the Rigidbody 2D component, refer to 2D physics instead.
Explore the properties you can use to configure a chain shape in the Unity Editor using the Physics Core 2D API.

Surface Material

The properties in the Surface Material section determine how the shape interacts with other shapes.

Property

Description

FrictionSets the coefficient of friction for this collider. A value of 0 means no friction, like ice. A value of 1 means very high friction, like rubber. The default is 0.6.
BouncinessSets how bouncy the surface is, and how much other colliders bounce off it. A value of 0 means the surface is not at all bouncy, like soft clay. A value of 1 means the surface is very bouncy, like rubber. The default is 0.
Friction MixingDetermines the method Unity uses to mix the friction of two objects when they make contact. The options are:
  • Average: Uses the average of the two values.
  • Mean: Uses the geometric mean of the two values. The geometric mean multiplies the two values then returns the square root.
  • Multiply: Multiplies the two values together.
  • Minimum: Uses the smaller value.
  • Maximum: Uses the larger value.
Bounciness MixingDetermines the method Unity uses to mix the bounciness of two objects when they make contact. The options are:
  • Average: Uses the average of the two values.
  • Mean: Uses the geometric mean of the two values. The geometric mean multiplies the two values then returns the square root.
  • Multiply: Multiplies the two values together.
  • Minimum: Uses the smaller value.
  • Maximum: Uses the larger value.
Friction PriorityDetermines which shape contributes its Friction Mixing mode when two shapes come into contact. Unity uses the Friction Mixing mode from the shape with the highest Friction Priority value. If the two shapes have the same Friction Priority value, Unity uses the highest
SurfaceMaterial.MixingMode
enumeration value from the two shapes.
Bounciness PriorityDetermines which shape contributes its Bounciness Mixing mode when two shapes come into contact. Unity uses the Bounciness Mixing mode from the shape with the highest Bounciness Priority value. If the two shapes have the same Bounciness Priority value, Unity uses the highest
SurfaceMaterial.MixingMode
enumeration value from the two shapes.
Rolling ResistanceSets how resistant the shape is to rolling. The range of values is 0 to 1, where 0 means no rolling resistance and 1 means full rolling resistance.
Tangent SpeedSets the speed the surface moves other objects that come into contact with it, in meters per second. For example, if you set Tangent Speed to 5, the surface acts like a conveyor belt that moves objects along the surface at 5 meters per second. You can use a positive or negative value to set the direction of movement.
Custom ColorSets the color Unity uses to draw the debug visualization of the shape. The alpha value is ignored. For more information, refer to Draw a debug visualization of objects.

Contact Filter

The properties in the Contact Filter section determine which other shapes the shape collides with. For more information, refer to Configure collisions between objects.

Property

Description

CategoriesSets the layers this shape belongs to.
ContactsSets the layers this shape collides with.
Group IndexAssigns the shape to a group, and overrides the Categories and Contacts properties. Use the following values:
  • 0: Assigns no group. The shape uses the Categories and Contacts properties to determine collisions.
  • Positive value: The shape always collides with other shapes that have the same Group Index.
  • Negative value: The shape doesn't collide with other shapes that have the same Group Index.

Other properties

Property

Description

Is LoopConnects the first and last vertices of the chain to form a loop.
Trigger EventsProduces a trigger event when the shape starts and ends overlapping another shape that has its Is Trigger property enabled. To fetch events, refer to
PhysicsWorld.triggerBeginEvents
.
World DrawingDraws the chain when Unity draws the debug visualization of the world. For more information, refer to Draw a debug visualization of objects.

Additional resources