
1,首先把之前的腳本複制一份,重新編寫此腳本
2,,這裡寫代碼片
//找到
private void OnTrackingFound()
{
GameObject aixi = Instantiate(aixiPrefab,transform.position-new Vector3(0,-1.6f,0),transform.rotation);
aixi.transform.parent = this.transform;
GameObject e1 = Instantiate(bloodPrefab1, transform.position, Quaternion.identity);
e1.transform.parent = this.transform;
Destroy(e1, 5f);
GameObject e2 = Instantiate(bloodPrefab2, transform.position, Quaternion.identity);
e2.transform.parent = this.transform;
Destroy(e2, 5f);
}
//丢失識别圖
private void OnTrackingLost()
{
Destroy(GameObject.Find("aixi(Clone)"));
Destroy(GameObject.Find("e1(Clone)"));
Destroy(GameObject.Find("e2(Clone)"));
}
3,制作陰影,添加一個renderTexture - 賦給相機- 添加一個3DPlane-把renderTexture- 賦給3DPlane-把相機改為SolidColor
4,改變物體的Layer層-使相機隻照射到aixi層