PhysicMaterial.frictionDirection2 摩擦力方向

var frictionDirection2 : Vector3

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.

dynamicFriction2和staticFriction2将沿着frictionDirection2被应用。各向异性(有向性)方向相对于碰撞器的自身坐标系统。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void Awake() {
		collider.physicMaterial.frictionDirection2 = Vector3.forward;
		collider.physicMaterial.dynamicFriction2 = 0;
		collider.physicMaterial.dynamicFriction = 1;
	}
}
// Make the collider slippery when going forward but not when going sideways
//使碰撞向前滑动而不是侧滑

collider.physicMaterial.frictionDirection2 = Vector3.forward;
collider.physicMaterial.dynamicFriction2 = 0;
collider.physicMaterial.dynamicFriction = 1;
最后修改:2011年3月31日 Thursday 10:05

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。