应用阴影偏差以防止自我阴影瑕疵。指定的值是每一段的轨迹宽度比例。
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { private TrailRenderer tr;
void Start() { tr = GetComponent<TrailRenderer>(); tr.material = new Material(Shader.Find("Standard")); tr.castShadows = true; tr.receiveShadows = true; tr.shadowBias = 0.3f; } }