- 最后登录
- 2019-12-2
- 注册时间
- 2012-8-25
- 阅读权限
- 90
- 积分
- 34660
- 纳金币
- 38268
- 精华
- 111
|
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
void Update() {
RaycastHit[] hits;
hits = Physics.RaycastAll(transform.position, transform.forward, 100.0F);
int i = 0;
while (i < hits.Length) {
RaycastHit hit = hits;
Renderer renderer = hit.collider.renderer;
if (renderer) {
renderer.material.shader = Shader.Find("Transparent/Diffuse");
renderer.material.color = new Color(renderer.material.color.r,renderer.material.color.g,renderer.material.color.b,0.3f);
}
i++;
}
}
}
绘制被遮挡部分 ZTest Off, ZTest Greater 绘制未被遮挡部分 ZTest On, ZTest LEqual 效果
|
|