Version: 2021.1
public PhysicMaterial material ;

描述

碰撞体使用的材质。

如果碰撞体共用材质, 则它将复制该材质,然后将其分配到该碰撞体。

using UnityEngine;

public class Example : MonoBehaviour { // Expose properties in the inspector for easy adjustment. float dynFriction; float statFriction;

Collider coll;

void Start() { coll = GetComponent<Collider>();

coll.material.dynamicFriction = dynFriction; coll.material.staticFriction = statFriction; } }