trackPosition

PHOTO EMBED

Sun Oct 24 2021 22:38:45 GMT+0000 (Coordinated Universal Time)

Saved by @dervish

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);


    }
}
content_copyCOPY