using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class trackPosition : MonoBehaviour
{
private GameObject tracker;
private Material grassMat;
// Start is called before the first frame update
void Start()
{
grassMat = GetComponent<Renderer>().material;
}
// Update is called once per frame
void Update()
{
tracker = GameObject.Find("tracker");
Vector3 trackerPos = tracker.GetComponent<Transform>().position;
grassMat.SetVector("_trackerPosition", trackerPos);
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter