PhysicMaterial.PhysicMaterial 构造物理材质

static function PhysicMaterial () : PhysicMaterial

Description描述

Creates a new material.

创建一个新的物理材质。

It is usually easier to just use collider.material and modify the attached material directly.

通常只使用collider.material和直接修改附加的材质更加简单。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void Start() {
		PhysicMaterial material = new PhysicMaterial();
		material.dynamicFriction = 1;
		collider.material = material;
	}
}
// Creates a new material and attaches it
//创建一个新的材质并附加它
function Start () {
	var material = new PhysicMaterial();
	material.dynamicFriction = 1;
	collider.material = material;
}

static function PhysicMaterial (name : string) : PhysicMaterial

Description描述

Creates a new material named name.

创建一个名为name的新的材质。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void Start() {
		PhysicMaterial material = new PhysicMaterial("New Material");
		material.dynamicFriction = 1;
		collider.material = material;
	}
}
// Creates a new material attaches and attaches it
//创建一个新的材质并附加它

function Start () {
	var material = new PhysicMaterial("New Material");
	material.dynamicFriction = 1;
	collider.material = material;
}
Page last updated: 2011-3-31