Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PixelGetter : MonoBehaviour {
- Ray _ray;
- RaycastHit _hit;
- Renderer _renderer;
- public CRT_LEVEL1 crt;
- // Use this forendererr initialization
- void Start () {
- _ray = new Ray(transform.position, Vector3.down);
- _renderer = GetComponent<Renderer>();
- }
- // Update is called once per frame
- void Update () {
- _ray.origin = transform.position;
- if (Physics.Raycast(_ray, Mathf.Infinity, LayerMask.GetMask("Shaded")))
- {
- //remplace ça par ta fonction a toi
- _renderer.material.color = crt.texture.GetPixel((int)_hit.textureCoord.x, (int)_hit.textureCoord.y);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement