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;
}
最后修改:2011年3月31日 Thursday 10:27

本脚本参考基于Unity 3.4.1f5

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