20 lines
441 B
C#
20 lines
441 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class GroundFollow : MonoBehaviour
|
|
{
|
|
public Transform target;
|
|
Vector3 offset;
|
|
void Start()
|
|
{
|
|
offset =transform.position - target.position;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
transform.position = new Vector3(target.position.x, transform.position.y, target.position.z + offset.z);
|
|
}
|
|
}
|