1234567891011121314151617181920212223 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class FollowHead : MonoBehaviour
- {
- [SerializeField]
- GameObject Head;
- private MeshRenderer mesh;
- // Start is called before the first frame update
- void Start()
- {
- mesh = GetComponent<MeshRenderer>();
- }
- // Update is called once per frame
- void Update()
- {
- transform.position = Head.transform.position - Vector3.up * mesh.bounds.size.y/2 ;
- }
- }
|