Version: 5.4 beta (switch to 5.3)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Removed in version 5.4.0
Anisotropic friction is no longer supported since Unity 5.0.

PhysicMaterial.frictionDirection2

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public var frictionDirection2: Vector3;
public Vector3 frictionDirection2;

Description

The direction of anisotropy. Anisotropic friction is enabled if the vector is not zero.

DynamicFriction2 and staticFriction2 will be applied along frictionDirection2. The direction of anisotropy is relative to the colliders local coordinate system.

var coll: Collider;

function Start() { coll = GetComponent.<Collider>(); // Make the collider slippery when going forward but not when going sideways. coll.material.frictionDirection2 = Vector3.forward; coll.material.dynamicFriction2 = 0; coll.material.dynamicFriction = 1; }
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Collider coll; void Start() { coll = GetComponent<Collider>(); coll.material.frictionDirection2 = Vector3.forward; coll.material.dynamicFriction2 = 0; coll.material.dynamicFriction = 1; } }